From d2f93f7c8aef0037a87a3e8ad36ea10b2b6be9c8 Mon Sep 17 00:00:00 2001 From: Marvin <39676950+togir2@users.noreply.github.com> Date: Thu, 2 Mar 2023 20:20:09 +0100 Subject: [PATCH] fix(playout): when shows ends, next shows starts without fade-in/fade-out (#2412) Tracks are not fading with the crossfade function which leads to hard cuts at the end of tracks and shows. Therefore the explicit fade functions are used. In Liquidsoap version 1.4.3. crossfade is implemented as a cross with a custom transition (fade_in and fade_out). https://github.com/savonet/liquidsoap/blob/9f730f2c5f6195e37a761f7b1eb5a74395d22b18/src/libs/fades.liq#L433-L436 The "duration" argument is passed through to the cross function. In the implementation of the cross operator the value duration is used to determine how log the crossfade should take. It is set to the cross_lenght parameter https://github.com/savonet/liquidsoap/blob/f075905715584bdc236fe2078e26352a5b7f1c5f/src/operators/cross.ml#L30-L34 This can be overwritten with metadata, but the current annotation does not include a "override_duration" field so in our case it is always 0. https://github.com/savonet/liquidsoap/blob/f075905715584bdc236fe2078e26352a5b7f1c5f/src/operators/cross.ml#L186-L198 So I assume the crossfade is starting to fade.out the track but because the duration is set to 0. the "cross" is completed immediately and the next source of the queue is started. Our queues do only ever contain one track at a time so there is no next source to play. The next queue is activated and the same happens for the fade.in. Replacing the crossfade with a fade.in/out removes this time boundary as there is no longer a "cross" function involved. Until the tag 3.0.0-alpha.8 there was a custom crossfade_airtime function. In tag 3.0.0-alpha.9 it was replaced with the crossfade function but was unable to find why. https://github.com/libretime/libretime/blob/ecd302068c443af3eaa44bd3f81f45cdd88b2155/python_apps/pypo/liquidsoap/1.4/ls_script.liq#LL76C9-L76C18 Co-authored-by: Marvin --- playout/libretime_playout/liquidsoap/1.4/ls_script.liq | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/playout/libretime_playout/liquidsoap/1.4/ls_script.liq b/playout/libretime_playout/liquidsoap/1.4/ls_script.liq index c4708a9f8..620f73377 100644 --- a/playout/libretime_playout/liquidsoap/1.4/ls_script.liq +++ b/playout/libretime_playout/liquidsoap/1.4/ls_script.liq @@ -23,8 +23,11 @@ def create_source() l = cue_cut(l) l = amplify(1., override="replay_gain", l) - # the crossfade function controls fade in/out - l = crossfade(duration=0., smart=true, l) + # Fade the tracks to avoid hard cuts in between two tracks and at the end of the shows. + # Liquidsoap reads the fade in/out durations from the annotation "liq_fade_in/out" which + # value can be set via Libretime settings. + l = fade.in(l) + l = fade.out(l) l = on_metadata(notify_queue, l)