feat: optional EBU R128 loudness normalization (--normalize)#185
Open
seonghobae wants to merge 1 commit into
Open
feat: optional EBU R128 loudness normalization (--normalize)#185seonghobae wants to merge 1 commit into
seonghobae wants to merge 1 commit into
Conversation
Add a --normalize flag (store_true, default False) that applies the ffmpeg loudnorm filter (loudnorm=I=-16:TP=-1.5:LRA=11) to generated audio for both the FLAC and Opus plan paths. Voice recordings vary widely in loudness; this evens them out to the EBU R128 target. normalize is threaded through the same chain as prefer_flac (parse_args -> _execute_conversions -> convert_file -> _convert_segment -> _execute_segment_conversion -> build_audio_plan/build_opus_plan) and defaults to False everywhere, so web/mcp callers and default CLI runs produce byte-identical ffmpeg args to before. Tests assert the flag parses on/off, that loudnorm is present in both flac and opus args when enabled, and that the default-off arg lists are byte-identical. Coverage 100%, interrogate 100%. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CJRVbDrp1vGYkJgNHMGPpG
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Recorded audio varies wildly in loudness (voice memos, meetings). Opt-in
--normalizeapplies EBU R128 (loudnorm=I=-16:TP=-1.5:LRA=11) for consistent, comfortable playback.What
--normalizeflag (default OFF = byte-identical output).LOUDNORM_FILTER+_with_loudnorm(args, normalize)helper (mirrors_with_ffmpeg_threads).normalizethreaded through the same chain asprefer_flac(parse_args → _execute_conversions → convert_file → _convert_segment → _execute_segment_conversion → build_audio_plan/build_opus_plan), applied to both FLAC and Opus paths.Safety / Tests
Default-off arg lists asserted byte-identical to before (flac + opus). +6 tests.
media_shrinker.py100% coverage;interrogate100%; no new failures.🤖 Generated with Claude Code