Repository navigation
feat(addmusic): duck background music and schedule sound effects - #161
Conversation
ConalMullan
left a comment
There was a problem hiding this comment.
Thanks. Ducking music under speech is a real gap: addmusic.py mixes at a fixed volume, and our templates don't duck at all. A few changes before it can land:
- Make it
addmusic.py --duck(plus--eventsfor timed effects), not a new tool.addmusic.pyis where people already go to put music on a video, and a second music mixer would split the docs and the habit. - Rebase onto the shared
media_ops.pyonce #162 lands, rather than carrying a copy (or inline the few helpers you need). - Run by default and overwrite outputs, writing via temp file +
os.replacerather thanos.link(see the conventions note on #162). - Loudness: run the result through
qc.py --renderin a test or the docs example, so the ducked mix stays near -14 LUFS and doesn't fall well under it. - A few lines in CLAUDE.md under the music section, rather than
docs/audio-mix.md.
|
@ConalMullan, I addressed your review in
All six focused audio tests passed, including measured ducking/recovery and timed effects. The five updated branches merge together without conflicts. Combined verification ran 153 Python tests, with 151 passing and two POSIX process tests skipped on Windows. The existing undefined-name lint passed. A real combined CLI flow produced a 1080x1920 Short with joined audio, ducked music, timed effects, SRT/VTT and a QC-normalized mix measured at -14.03 LUFS. |
# Conflicts: # CLAUDE.md
…o a mono or low-rate narration no longer folds stereo music to mono, and a missing effect file is named Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, this is a big step on from the first version. Ducking lives in addmusic.py, the copy of media_ops.py is gone, outputs are replaced through a temp file and os.replace, and the qc.py loudness test is a nice touch. We found one thing and fixed it on your branch so we could merge today: amix takes the first input's format, so a mono 22.05 kHz narration with stereo music gave a mono 22.05 kHz track. Every input is now brought to 48 kHz stereo before the mix, with a test. A missing effect file now names the path instead of printing the ffprobe command, and we kept both sections where CLAUDE.md conflicted with the new sfx_search one (the effects line points to it). Merged, thank you. |
Videos with narration need music to drop during speech and recover in pauses. This extends
addmusic.pywith--duckand--events, preserving its existing music-file and ElevenLabs prompt workflows.--speechsupplies isolated narration, and attack/release controls use milliseconds.os.replace, and preserve the previous output on encoder failure.--dry-runperforms no writes or API calls.audio_mix.pyentry point, its registry entry, per-tool document and duplicatemedia_ops.py. Document the feature in the music section ofCLAUDE.mdand the existing addmusic registry entry.qc.py --render --fixand verification commands because a peak limiter does not set integrated loudness.Validation ran six focused tests with real FFmpeg audio measurements, timed-effect windows, default CLI reruns, silent-video music looping, failure preservation and delivery loudness after QC normalization. No paid generation was called. This uses installed FFmpeg and existing dependencies, with the existing billed ElevenLabs path remaining optional.
The five updated branches merge together without conflicts. Combined verification ran 153 Python tests, with 151 passing and two POSIX process tests skipped on Windows. The existing undefined-name lint passed. A real combined CLI flow produced a 1080x1920 Short with joined audio, ducked music, timed effects, SRT/VTT and a QC-normalized mix measured at -14.03 LUFS.
Feature inventory