Hello! I've been running into this issue a bit over the last few months, and I 
recently attempted to fix it only to discover that I made it much worse.

The situation is a basic one: fading between the AutoDJ's music and an incoming 
live broadcast. I've set up a `live_enabled` switch to prevent some issues 
where intermittent connectivity caused DJs to fade constantly back and forth 
between the AutoDJ and their stream; this replaces that with a quick 2-second 
fallback silence for the duration they're connected:

```
live_enabled = ref false

def live_connected(header) =
  live_enabled := true
end

def live_disconnected() =
  live_enabled := false
end

# ...radio defined previously

# Live Broadcasting
live = audio_to_stereo(input.harbor("/", id="azuratest_radio_input_streamer", 
port=8005, user="shoutcast", auth=dj_auth, icy=true, max=30., buffer=5., 
icy_metadata_charset="UTF-8", metadata_charset="UTF-8", 
on_connect=live_connected, on_disconnect=live_disconnected))
ignore(output.dummy(live, fallible=true))

live = fallback(id="azuratest_radio_live_fallback", track_sensitive=false, 
[live, blank(duration=2.)])
radio = switch(id="azuratest_radio_live_switch", track_sensitive=false, 
[({!live_enabled}, live), ({true}, radio)])
```

This is causing an abrupt jump both when the DJ connects and when they 
disconnect. When connecting, the AutoDJ stream immediately stops and the live 
DJ stream immediately starts, with no transition. When stopping, the AutoDJ 
starts back up again at full volume, with the live signal "fading" into the 
full-volume AutoDJ. Neither of these are desirable effects.

To help resolve this, I tried assigning a custom transition to the live DJ 
switch that performed a very simple fade:

```
def simple_crossfade(a,b) =
  add([fade.initial(duration=3.,b),fade.final(duration=3.,a)])
end

radio = switch(id="azuratest_radio_live_switch", track_sensitive=false, 
transitions=[simple_crossfade], [({!live_enabled}, live), ({true}, radio)])
```

...but this yields even more inconsistent results and still no smooth fading 
between the two.

Am I doing something obviously wrong? I get the feeling I am, but despite years 
of hammering away at the Liquidsoap internal language I sometimes don't feel as 
though I understand it.

Any help would be appreciated.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/savonet/liquidsoap/issues/746
_______________________________________________
Savonet-users mailing list
Savonet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to