Liquidsoap 0.9.2 : Blank detection

Blank detection

Liquidsoap has three operators for dealing with blanks.

On GeekRadio, we play many files, some of which include bonus tracks, which means that they end with a very long blank and then a little extra music. It's annoying to get that broadcasted. The skip_blank operator skips the current track when a too long blank is detected, which avoids that. The typical usage is simple:

# Wrap it with a blank skipper
source = skip_blank(source)
Grab the code!

At RadioPi they have another problem: sometimes they have technical problems, and while they think they are doing a live show, they're making noise only in the studio, while only blank is broadcasted; sometimes, the staff has so much fun (or is it something else ?) doing live shows that they live at the end of the show without thinking to turn off the live, and the listeners get some silence again. To avoid that problem we made the strip_blank operators which hides the stream when it's too blank (i.e. declare it as unavailable), which perfectly suits the typical setup used for live shows:

interlude = single("/path/to/sorryfortheblank.ogg")
# After 5 sec of blank the microphone stream is ignored,
# which causes the stream to fallback to interlude.
# As soon as noise comes back to the microphone the stream comes
# back to the live -- thanks to track_sensitive=false.
stream = fallback(track_sensitive=false,
	              [ strip_blank(length=5.,live) , interlude ])

# Put that stream to a local file
Grab the code!

If you don't get the difference between these two operators, you should learn more about liquidsoap's notion of source.

Finally, if you need to do some custom action when there's too much blank, we have on_blank:

def handler()
  system("/path/to/your/script to do whathever you want")
source = on_blank(handler,source)
Grab the code!