This is a small tutorial on how to crossfade with liquidsoap. I have muddled around for almost a week before figuring this out. Perhaps this will help someone in the future. Tested on Airtime 2.1.3
Add the following lines to your /usr/lib/airtime/pypo/bin/liquidsoap_scripts/ls_script.liq just under the line "%include "ls_lib.liq""
add = fun (from,to) -> add(normalize=false, [ to,from ])
log = log(label="my_fade") def transition (a, b, ma, mb, sa, sb) if (a + mf_high >= 0. and b + mf_high >= 0.) or (a + mf_medium >= 0. and b + mf_medium >= 0. and abs(a - b) <= mf_margin) then log("No transition, just sequencing.") sequence([sa, sb])
elsif a + mf_medium <= 0. and b + mf_medium >= 0. and abs(a - b) <= mf_margin then log("Using transition 1: crossed.") add(fade.out(sa),fade.in(sb)) elsif b >= a + mf_margin and a <= mf_high then log("Using transition 2: crossed, fade-out.") add(fade.out(sa),sb) elsif a >= b + mf_margin and b <= mf_high then log("Using transition 3: crossed, fade-in.") add(sa,fade.in(sb)) else log("Using transition 4: crossed, fade-in, fade-out.") add(fade.out(sa),fade.in(sb)) end end smart_cross(transition,width=width,duration=start_next,conservative=conservative,s) end
now look for the line "queue = map_metadata(append_title, queue)" and add this line under it:
queue = my_fade(queue)
Thats it. Restart your server or the playout service with
sudo service airtime-playout restart
Crossfading should now work based on the values of: ~start_next=3.,~fade_in=3.,~fade_out=3.,~width=1 You may edit these values to suit your needs. The script uses a smart crossfade by checking the relative volumes of the current track and the next track and applies an effect accordingly.
I have not written this script. It was taken from the dolebrai script which I found on the liquidsoap site.
This will defn help some of our users. The only downside of this script is that the user cannot customize their crossfades on a per-track basis. This is something that is being worked on and should be available in future versions of Airtime :)