Simple crossfading seemingly not respecting fade_in, smart crossfading results in unbearable volume jumps at crossing point
Describe the bug
Over at https://github.com/AzuraCast/AzuraCast/issues/6117, we’re discussing if something might be broken with simple and smart crossfading. Buster currently uses 2.1.3, I believe.
We’re trying to get a more "radio-like" smart crossfading done, that fades out for 2s, has no fade_in, and should start the new song at the start of the fade-out.
It looks as if cross.simple doesn’t respect fade_in, and cross.smart does but sometimes produces an unbearable volume jump at the crossing point. (The "old" song receives a volume boost during its fade-out.) We’re just guessing but the gut feeling is that it might have something to do with replaygain (using the RG values stored in the standard ID3v2.3/Vorbis Comment tags.
To Reproduce
Here’s the two versions we tried, one using cross.simple, one using cross.smart, as part of the overall AzuraCast LiquidSoap code.
Note the volume jumps occur only occasionally, usually when "old" was rather loud and "new" starts with low volume. It might take a few (replaygain-tagged) songs until this happens.
Using cross.simple (fade_in doesn’t work)
def live_aware_crossfade(old, new) =
if !to_live then
# If going to the live show, play a simple sequence
sequence([fade.out(old.source),fade.in(new.source)])
else
# Otherwise, use the smart transition
cross.simple(old.source, new.source, fade_in=0.00, fade_out=2.00)
end
end
radio = cross(minimum=2.0, duration=3.0, live_aware_crossfade, radio)
Using cross.smart (almost works, but sometimes unbearable volume jump at crossing point)
def live_aware_crossfade(old, new) =
if !to_live then
# If going to the live show, play a simple sequence
sequence([fade.out(old.source),fade.in(new.source)])
else
# Otherwise, use the smart transition
cross.smart(old, new, fade_in=0.00, fade_out=2.00)
end
end
radio = cross(minimum=2.0, duration=5.0, live_aware_crossfade, radio)
Expected behavior A clean crossfade with no volume jumps, fade-out starting 2s before end of "old", "new" starting when "old" starts fading out, with no fade-in.
Version details
- OS: Ubuntu 22.04 server
- Version: I think 2.1.3 is currently used.
Install method Comes with AzuraCast, Rolling Release (runs in a docker).
Common issues —
We’d much appreciate if someone more knowledgeable from here could step in and help diagnose/repair the problem—thanks in advance!
My next try:
Edit Station Profiles Crossfade Method = Normal Mode Crossfade Duration (Seconds) = 3
Edit Liquidsoap Configuration
.......
cross.simple(old.source, new.source, fade_in=0.00, fade_out=3.00)
end
end
radio = cross(minimum=3., duration=3.00, live_aware_crossfade, radio)
..........
Happy listening