Skip to content

feat: adaptive snap release for upward compressor stage - #22

Merged
huberp merged 2 commits into
mainfrom
copilot/add-snap-release-parameter
May 1, 2026
Merged

feat: adaptive snap release for upward compressor stage#22
huberp merged 2 commits into
mainfrom
copilot/add-snap-release-parameter

Conversation

Copilot AI commented May 1, 2026

Copy link
Copy Markdown
Contributor

During silence, the upward stage's gainEnv accumulates a large boost. When a transient arrives, targetGainDb drops to zero immediately but gainEnv decays at the normal (slow) release rate — amplifying the transient for several milliseconds. Fix: detect the silence-to-transient event (>6 dB downward jump in target) and substitute a fast "snap" release coefficient for that decay cycle.

DSP (CompressorStage.h)

  • Added snapReleaseMs / snapReleaseCoeff / snapReleaseEnabled state
  • updateCoefficients() now precomputes snapReleaseCoeff
  • Ballistics step selects snap coeff when upward stage is releasing and genv − targetGainDb > kSnapReleaseThresholdDb (6 dB, hardcoded detection threshold — not user-visible)
if (!attacking) {
    if (direction == StageDirection::Upward
        && snapReleaseEnabled
        && (genv - targetGainDb) > kSnapReleaseThresholdDb)
        coeff = snapReleaseCoeff;
    else
        coeff = releaseCoeff;
} else {
    coeff = attackCoeff;
}

Parameters (PluginProcessor.h/.cpp)

  • up_snap_release_enabledAudioParameterBool, default off
  • up_snap_releaseAudioParameterFloat, 0.5–50 ms, default 5 ms
  • Both pushed to CompressorStage each block via OttCompressor delegating setters

UI (PluginEditor.h/.cpp)

  • "Snap Rel" toggle + "Snap Rel (ms)" slider added to the Upward group
  • Slider/label hidden when toggle is off; visibility correctly initialised from loaded parameter state on plugin open
  • Upward group resizes dynamically: 6 rows (toggle off) or 7 rows (toggle on)

@huberp
huberp marked this pull request as ready for review May 1, 2026 07:42
@huberp
huberp merged commit 5278d0b into main May 1, 2026
2 checks passed
@huberp
huberp deleted the copilot/add-snap-release-parameter branch May 1, 2026 07:42
@huberp

huberp commented May 1, 2026

Copy link
Copy Markdown
Owner

@copilot revert this PR from main and apply it to branch "release-0.5.0"

Copilot AI added a commit that referenced this pull request May 1, 2026
* feat: implement adaptive snap release for upward compressor stage

Agent-Logs-Url: https://github.com/huberp/phu-compressor/sessions/c815b2c6-8199-4138-9158-565e7af7f972

Co-authored-by: huberp <4027454+huberp@users.noreply.github.com>

* fix: address review feedback - named constant for snap threshold, fix initial visibility

Agent-Logs-Url: https://github.com/huberp/phu-compressor/sessions/c815b2c6-8199-4138-9158-565e7af7f972

Co-authored-by: huberp <4027454+huberp@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: huberp <4027454+huberp@users.noreply.github.com>
huberp added a commit that referenced this pull request May 1, 2026
* feat: implement adaptive snap release for upward compressor stage

Agent-Logs-Url: https://github.com/huberp/phu-compressor/sessions/c815b2c6-8199-4138-9158-565e7af7f972



* fix: address review feedback - named constant for snap threshold, fix initial visibility

Agent-Logs-Url: https://github.com/huberp/phu-compressor/sessions/c815b2c6-8199-4138-9158-565e7af7f972



---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: huberp <4027454+huberp@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants