Repository navigation
fix(bgm): carry a short BGM on from past its intro with a crossfade instead of restarting it - #34
Merged
Merged
Conversation
…nstead of restarting it
…e does not thin the music
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.
Summary
When the film is longer than the BGM track, the music now carries on as the same piece instead of restarting from its intro with a hard cut.
Closes #32. Part of #16.
Changes
scripts/audio.tsmediaSeconds(file)reads a file's length from ffmpeg's Duration line (no decoding)bgmLoop()builds the BGM inputs and filters. If the track is long enough, nothing changes. If it is short, the first pass stops before the last 6 s (the closing bars fade out), then the track returns to 30 s (a quarter in for short tracks), past the intro, with a 3 s crossfade, as many times as the film needs. A track under 18 s, too short to crossfade, still loops from its startmixuses it; sound effect input numbers follow the BGM inputs-ss 30 -t … -i bgm). The first version split one input withasplitand crossfaded the branches: it worked with ffmpeg 8.1 but with the bundled ffmpeg 6.0 the music stopped at the first crossfade (silent BGM from 2:50 in a 194 s film). Leaving out the closing bars came from measuring the next version: crossfading the track's fade-out made the music thin for about 4 sTest plan
make check: lint, format, typecheck, 107 tests with the coverage gate, quality gatesbgmLoopfor a long-enough track, one return (178 s track, 194 s film), many returns (40 s, 150 s), a too-short track;mediaSecondsreads Duration and fails without itasplitversion stops at 14 s, so this test catches it)