#!/usr/bin/liquidsoap set log.stdout = true set log.dir = "/tmp" set telnet = true # Define a numbers source that plays a number station, # or files from a queue that can be fed by the user using telnet. numbers = input.http("http://zenodore.streaming.radiopytagor.net:8000/numbers-station.ogg") numbers = strip_blank(length=2.,threshold=-30.,numbers) numbers = fallback([normalize(request.queue(id="q")),numbers]) # mksafe turns a faillible source into an infaillible source def mksafe(s) fallback(track_sensitive=false,[s,blank()]) end # We relay the Dolebrai libre music netradio. # We wrap it in mksafe(), a predefined operator that plays # blank when dolebrai fails to relay anything. normal = mksafe(input.http("http://dolebrai.net:8000/dolebrai.ogg")) # And now the magic :) def smooth_add(~normal,~special) d = 1. # delay before mixing after beginning of mix p = 0.2 # portion of normal when mixed fade.final = fade.final(duration=d*.2.) fade.initial = fade.initial(duration=d*.2.) q = 1. -. p # We alias change_volume to c c = change_volume fallback(track_sensitive=false, [special,normal], transitions=[ fun(normal,special)-> add(normalize=false,[sequence([blank(duration=d),c(q,special)]), c(q,fade.final(normal)), c(p,normal)]), fun(special,normal)-> add(normalize=false,[c(p,normal),c(q,fade.initial(normal))]) ]) end # out is a predefined operator that # outputs to your local sound card using libao output.ao(smooth_add(normal=normal,special=numbers))