Skip to content

fix(processor): add adaptive floor to levelling-compressor threshold#131

Merged
flexiondotorg merged 2 commits into
mainfrom
compressor
Jun 17, 2026
Merged

fix(processor): add adaptive floor to levelling-compressor threshold#131
flexiondotorg merged 2 commits into
mainfrom
compressor

Conversation

@flexiondotorg

Copy link
Copy Markdown
Contributor

Floor the elected speech RMS at the full-file overall RMS before the +9 dB
offset, so an anomalously-quiet speech election cannot drag the threshold too
low. Measurement-derived (no magic constant), raises only, fixes 3 stems with
quiet-region anomalies and 13 others with minor quiet bias. Output LUFS and
true peak held to spec; dynamics on affected stems measurably gentler.

  Floor the elected speech RMS at the full-file overall RMS before the +9 dB
  offset, so an anomalously-quiet speech election cannot drag the threshold too
  low. Measurement-derived (no magic constant), raises only, fixes 3 stems with
  quiet-region anomalies and 13 others with minor quiet bias. Output LUFS and
  true peak held to spec; dynamics on affected stems measurably gentler.

Signed-off-by: Martin Wimpress <code@wimpress.io>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 4 files

Confidence score: 3/5

  • In internal/processor/adaptive_levelling_compressor.go, the floor logic currently treats missing astats RMS as 0 dBFS, which can raise the adaptive threshold too aggressively and cause incorrect compression behavior in output audio; add an explicit “RMS was measured” guard before applying the floor so absent stats don’t influence thresholding before merging.

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread internal/processor/adaptive_levelling_compressor.go Outdated
…stats

  When astats fails to measure RMS, Dynamics.RMSLevel stays at 0.0 (the
  unmeasured sentinel). The previous NaN/Inf guard did not catch this,
  causing the floor max(speechRMS, 0.0) to pin the threshold to -6 dBFS.
  Guard now checks for finite sub-zero levels only, treating 0.0 as
  unmeasured and leaving the floor inert, matching the codebase convention.

Signed-off-by: Martin Wimpress <code@wimpress.io>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 2 files (changes from recent commits).

Auto-approved: Adds an adaptive floor to the levelling-compressor threshold to guard against unusually quiet speech by comparing speech RMS to full-file RMS. Changes are isolated to a single core function and are well-documented with tests.

Re-trigger cubic

@flexiondotorg flexiondotorg merged commit fe48aff into main Jun 17, 2026
16 checks passed
@flexiondotorg flexiondotorg deleted the compressor branch June 17, 2026 15:52
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.

1 participant