Skip to content

feat: optional EBU R128 loudness normalization (--normalize)#185

Open
seonghobae wants to merge 1 commit into
mainfrom
feat/loudness-normalize
Open

feat: optional EBU R128 loudness normalization (--normalize)#185
seonghobae wants to merge 1 commit into
mainfrom
feat/loudness-normalize

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

Why

Recorded audio varies wildly in loudness (voice memos, meetings). Opt-in --normalize applies EBU R128 (loudnorm=I=-16:TP=-1.5:LRA=11) for consistent, comfortable playback.

What

  • --normalize flag (default OFF = byte-identical output).
  • LOUDNORM_FILTER + _with_loudnorm(args, normalize) helper (mirrors _with_ffmpeg_threads).
  • normalize 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), applied to both FLAC and Opus paths.

Safety / Tests

Default-off arg lists asserted byte-identical to before (flac + opus). +6 tests. media_shrinker.py 100% coverage; interrogate 100%; no new failures.

🤖 Generated with Claude Code

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
@seonghobae seonghobae enabled auto-merge (squash) July 6, 2026 14:26
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