Never mind. I figured it out. I omitted the important ‘end’ as below:

# Switch-based Transition
def crossfade(a,b)
        add(normalize=false,
        [ sequence([ blank(duration=5.),
        fade.initial(duration=10.,b) ]),
        fade.final(duration=10.,a) ])

end


It works now



- - -
I prefer to use encrypted email.
My public key fingerprint is 77CC 9087 0A92 F55D 75A3  660B 68F2 1FA9 B26E CAC7

> On 19 Apr 2018, at 11:11 am, Damian <d...@riseup.net> wrote:
> 
> Hi,
> 
> I'm trying to implement a crossfade between sources in my switch. My
> script works fine without the crossfade elements added to the scrip. But
> if I add transitions=[crossfade, crossfade] to my switch, I get a parse
> error. I can't see where the script is breaking. I added it below. I'm
> hoping someone else can see the problem.
> 
> Damian
> 
> 
> 
> 
> #!/usr/bin/liquidsoap
> # Log dir
> set("log.file.path","/tmp/ssr.log")
> 
> # Electronica Playlist Parts
> elid = playlist(mode="randomize", reload_mode = "watch",
> "/home/admin/music/elid")
> elfre = playlist(mode="randomize", reload_mode = "watch",
> "/home/admin/music/elfre")
> elgen = playlist(mode="randomize", reload_mode = "watch",
> "/home/admin/music/elgen")
> elarc = playlist(mode="randomize", reload_mode = "watch",
> "/home/admin/music/elarc")
> 
> 
> # Ambient Playlist Parts
> ambid = playlist(mode="randomize", reload_mode = "watch",
> "/home/admin/music/ambid")
> ambfre = playlist(mode="randomize", reload_mode = "watch",
> "/home/admin/music/ambfre")
> ambgen = playlist(mode="randomize", reload_mode = "watch",
> "/home/admin/music/ambgen")
> 
> 
> # If something goes wrong, this file will play
> security = single("/home/admin/music/default.mp3")
> 
> # Electronica Playlist Rotation
> electronica = rotate(weights = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> 1, 1, 1, 1, 1, 1],
> [elid, elfre, elgen, elfre, elgen, elfre, elgen, elfre, elgen, elid,
> elfre, elgen, elfre, elgen, elfre, elgen, elfre, elgen, elarc])
> 
> # Ambient Playlist Rotation
> ambient = rotate(weights = [1, 1, 1, 1, 1, 1, 1, 1, 1],
> [ambid, ambfre, ambgen, ambfre, ambgen, ambfre, ambgen, ambfre, ambgen])
> 
> # Switch-based Transition
> def crossfade(a,b)
>       add(normalize=false,
>       [ sequence([ blank(duration=5.),
>       fade.initial(duration=10.,b) ]),
>       fade.final(duration=10.,a) ])
> 
> # Schedule
> radio = fallback([switch(track_sensitive = false,
> transitions=[crossfade, crossfade], [
>               ({0h-19h}, electronica),
>               ({19h-0h}, ambient),]), security])
> 
> # Security
> #radio = fallback(track_sensitive = false, [radio, security])
> 
> # Stream it out
> output.icecast(%mp3(bitrate=128,samplerate=44100,internal_quality=0,id3v2=true,stereo=true,stereo_mode="stereo"),
> host="localhost",
> port=8000,password="***",
> mount = "SSR",genre="Ambient / Electronica",
> description="Systrum Sistum",
> name="SSR",url="http://localhost",radio)
> 
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Savonet-users mailing list
> Savonet-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/savonet-users

Attachment: signature.asc
Description: Message signed with OpenPGP

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Savonet-users mailing list
Savonet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to