Repository navigation
fix(cli): normalize-audio never cuts a clip that is quieter than the target - #6767
Conversation
There was a problem hiding this comment.
Verdict: REQUEST CHANGES · 1 blocker · 1 important · 0 nits · head 431a9e9c
The fix itself is right. The fails without the fix: line holds: with the clamp removed, the new test fails (expected -1 to be close to +0), and 44/44 pass at the head. cli normalize-audio tests pass 33/33.
- blocker:
Commentsis red. The run reportsRAISED comment share: packages/studio-server/src/helpers/loudness.ts is 5.0% (28/563), at the base 4.8% (27/560). That comes from the one new comment at line 547. Cut it, or move the explanation into a name (for exampleconst boostOnlyGainDb = …). ↓ inline - important ↓ inline: a held clip reports
withinTolerance: trueand prints "Already matched" however far it is from the target.
Scope
Read all of absoluteLoudnessPlan and both callers (CLI normalize-audio.ts and the Studio /loudness/normalize route). CI and Windows were still running when this was posted.
Edit accuracy: accurate 271 (base branch 271), smooth 141 of thoseThe gate passes. Quarantined, measured but not gated (0) Unstable (3)
|
…it holds it short of the target
There was a problem hiding this comment.
Verdict: REQUEST CHANGES — 1 resolved, 1 open, 2 new · 431a9e9 → e3b0605
New blockers, both from CI on this head: Comments is red again (loudness.ts 28/572, base 27/560), and oxfmt --check fails on normalize-audio.ts, which turns the required Format and Windows preflight checks red. Running oxfmt on that file fixes the second. Locally: loudness 47/47, cli normalize-audio 33/33.
What
normalize-audio --lufsno longer cuts a clip that is quieter than the target. When the true-peak ceiling stops a boost, the clip keeps its current gain andlimitedBysays why.Why
A clip measuring -17.1 LUFS with a peak past the -1.5 dBTP ceiling, asked for -17, was written with
data-volume0.81. That projects to -18.9 LUFS: further from the target than before, reported asok: true. The limit math took the lowest of the wanted gain and the ceilings, and the peak room is negative for such a clip, so a boost request became a cut.Related work
Trim windows are measured correctly on main (
-ss/-tas input options); this is not a window bug. Earlier work: the playback-start fix and the in-scene targeting fix, both merged.How
absoluteLoudnessPlanclamps the limited gain so that a request to go up never lands below the clip's current gain. Cuts are unchanged. A held clip haschangeDb0 and is not reported as matched:absoluteOutcomesaysmatched,heldorchange, the command prints that it cannot get closer, and nothing is written. This also explains a clip reportedwithinTolerance: truewhile far from the target.Test plan
fails without the fix: with the clamp removed,
never cuts a clip that is below the target because its peak is already past the ceilingfails withexpected -1 to be close to +0.What I measured
loudness.test.ts: 47 passed on three runs on the devbox; the cli normalize tests pass (33). Without the fix, 1 failed; withabsoluteOutcomeforced tomatched,calls a clip a limit cannot move held, not matchedfails withexpected 'matched' to be 'held'. Real ffmpeg on a built CLI: a pulsed tone at -17.1 LUFS with a near full-scale peak,--lufs=-17 --write --json, wrote 0.81 and projected -18.9 LUFS before the fix. A trimmed clip with the same tone measures its played window correctly (-21.9 LUFS).What I did NOT execute
The fixed CLI on the pulsed fixture after the change, and the reported "-19.7 LUFS, within tolerance, wrote nothing" case, which I could not tie to a cause (an earlier gain already on the clip would produce it).
Size
Under 100 lines on purpose: normalize-audio cuts clips it should boost today, and no open change touches it to carry this.