crossfade sample code #3838
Replies: 4 comments 1 reply
-
Never trust an "AI" to generate working code! There is no Then there’s also "The Book"—really worth reading. → https://www.liquidsoap.info/doc-dev/book.html |
Beta Was this translation helpful? Give feedback.
-
Thanks Moonbase59 for your help. You right, with Chat GPT implementation, I had an error about "start_next", so I removed it yesterday but I had another error message _At mux.liq, line 38, char 55-71: Error 5: this value has type I also read the 2 links you suggest (before to post my message yesterday) and I could not understand how to implement. Do you know the line I should implement to replace : Thanks a lot in advance |
Beta Was this translation helpful? Give feedback.
-
Hi ! Moonbase59, any other helper to help us ? ;) |
Beta Was this translation helpful? Give feedback.
-
Well, you already have a # Transition to live
def to_live(playlist, live) =
#sequence([playlist,live])
add([fade.in(duration=2.0, live), fade.out(duration=2.0, playlist)])
end
# Transition back to playlist
def to_playlist(live, playlist) =
#sequence([live, playlist])
add([fade.in(duration=2.0, playlist), fade.out(duration=2.0, live)])
end
radio = fallback(
track_sensitive=false,
transitions=[to_live, to_playlist],
[live, playlist]
) Out of my head, not tested. I just replaced the suggested — or — If you really wanted to use a radio = crossfade(fade_in=2.0, fade_out=2.0, radio) Notice the subtle differences:
Learn Liquidsoap, it’s not so easy but eventually pays, and you can do anything! |
Beta Was this translation helpful? Give feedback.
-
Hi guys, for a web radio project we implemented a very simple radio with liquidsoap :
playlist = playlist("/var/www/html/mp3")
live = input.http("http://localhost:8000/live.mp3")
radio = fallback(track_sensitive=false, [live, playlist])
output.icecast(%mp3, host = "localhost", port = 8000, password = "PWD", mount = "webradio.mp3", mksafe(radio))
The idea is to have a playlist (all day long) that we can interrupt at any time by a live.
And it works perfectly !
But now we would like to improve adding a fading transition from playlist to live and from live to playlist.
We tried to find help here and had a look to the documentation.
But we could not found.
We tried (advised by Chat GPT) to add :
radio_fading = crossfade(start_next=true, fade_in=2.0, fade_out=2.0, [live, playlist])
and changed last line as :
output.icecast(%mp3, host = "localhost", port = 8000, password = "PWD", mount = "webradio.mp3", mksafe(radio_fading))
but it doesn't work.
I guess solution is very simple ?
Nicolas
Beta Was this translation helpful? Give feedback.
All reactions