Switching between sources #4136
Replies: 4 comments 15 replies
-
If I understood correctly, then you just need to set track_sensitive=true in the switch statement. Then the switching will take place at the end of the track, therefore, when returning to the playlist there will be a new track. Or add a skip() function call as a workaround in some way. Silence I believe is endless source |
Beta Was this translation helpful? Give feedback.
-
Another workaround would be to gradually increase and decrease the levels when b is true/false, but i do not know how can this be implemented. |
Beta Was this translation helpful? Give feedback.
-
To anyone interested in this task, trying to solving it directly through liquidsoap is not feasible (at least me 1-2 weeks experimentation has showed me so). Thanks for the advice and the time! |
Beta Was this translation helpful? Give feedback.
-
Of course. Here is the script. Try connecting to input.harbor. Volume sliders won't work as expecteed cause smooth_add has it's inner controls. settings.harbor.bind_addrs := ["0.0.0.0"]
interactive.harbor(port=8007, uri="/djpanel")
volume_playlist = interactive.float("volume_playlist", min=0., max=1., 1.)
volume_overall = interactive.float("volume_overall", min=0., max=1., 1.)
volume_mic = interactive.float("volume_mic_add", min=0., max=1., 1.)
pause_playlist = interactive.bool("pause_playlist",false)
radio = playlist(mode="randomize", reload_mode="watch", "/music.m3u8")
radio = amplify(volume_playlist, radio)
def skipper(_)
radio.skip()
http.response(data="The song from the playlist was skipped!")
end
harbor.http.register.simple(port=8007, "/skip", skipper)
blank = blank()
radio = switch(track_sensitive=false, [
({pause_playlist() == true}, blank),
({true}, radio)
])
mic_add = input.harbor("mic_add", port=8006, password="hackme")
mic_add = amplify(volume_mic, mic_add)
#radio = add(normalize=false,[mic_add,radio])
radio = smooth_add(duration=3., p=0.3, normal=radio, special=mic_add)
radio = amplify(volume_overall, radio)
output(radio) |
Beta Was this translation helpful? Give feedback.
-
So, my task is to build a backend for a webradio with several automations. I have a front-end (html) and a back-end (flask) that communicate with each other and the back-end also communicates with the liquidsoap via telnet. I have a button that switches between 2 sources: a fallback_playlist and a microphone. I have observed that, when i switch from speech back to music, the source continues from the segment i have pushed the button. Why is that? Why doesn't the "silent" source continue in silence? Is there another workaround?
Below you can find my snippet
set("server.telnet", true)
set("server.telnet.port", 1234)
dynamic_queue = request.queue(id="music_queue")
initial_playlist = playlist("music_pool_playlist.m3u")
fallback_playlist = fallback([dynamic_queue, initial_playlist])
mic = sine()
b = interactive.bool("button", true)
shutdown_requested = interactive.bool("shutdown_requested", false)
radio_stream = switch(track_sensitive=false, [
(shutdown_requested, blank()),
(b, fallback_playlist),
({true}, mic)
])
radio_stream = crossfade(duration=2.0, fade_in=2.0, fade_out=2.0, radio_stream)
def shutdown_blank_handler() =
log("Stream has been blank for too long! Performing custom action.")
shutdown()
end
radio_stream = blank.detect(shutdown_blank_handler, radio_stream)
output.ao(radio_stream, fallible=true)
output.file(%mp3, "out.wav", radio_stream, fallible=true)
output.icecast(%mp3,
host="localhost", port=8000, password="password", mount="stream",
radio_stream, fallible=true)
Beta Was this translation helpful? Give feedback.
All reactions