Liquidsoap: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
Line 9: Line 9:
|Thumbnail=File:Liquidsoap-logo.png
|Thumbnail=File:Liquidsoap-logo.png
}}
}}
== Presentation ==
[https://fosdem.org/2020/schedule/event/om_liquidsoap/ Recently presented at Fosdem2020] also on [https://vimeo.com/388951779 vimeo]
== Documentation conventions ==
The docs have cryptic syntax, for instance the say_metadata filter is described with the signature:
  (source(?A), ?pattern : string) -> source(?A)
Which means you can call this function like:
  say_metadata(mysource)
or
  say_metadata(mysource, pattern="")


== Cookbook ==
== Cookbook ==
Line 118: Line 101:


How would you output a mono audio stream?
How would you output a mono audio stream?
== Presentation ==
[https://fosdem.org/2020/schedule/event/om_liquidsoap/ Recently presented at Fosdem2020] also on [https://vimeo.com/388951779 vimeo]
== Documentation conventions ==
The docs have cryptic syntax, for instance the say_metadata filter is described with the signature:
  (source(?A), ?pattern : string) -> source(?A)
Which means you can call this function like:
  say_metadata(mysource)
or
  say_metadata(mysource, pattern="")

Revision as of 07:41, 12 May 2020

Website http://liquidsoap.info/
License GPL
OS GNU/Linux, OS X, Windows
Media Streaming media
Format OGG, MP3
Interface Custom programming language
Wikipedia http://en.wikipedia.org/wiki/Draft:Liquidsoap
Thumbnail
Liquidsoap-logo.png


Cookbook

From: https://www.liquidsoap.info/doc-1.4.2/cookbook.html

The recipes show how to build a source with a particular feature. You can try short snippets by wrapping the code in an out(..) operator and passing it directly to liquidsoap:

 liquidsoap -v 'out(recipe)'

For longer recipes, you might want to create a short script:

#!/usr/bin/liquidsoap -v

set("log.file.path","/tmp/<script>.log")
set("log.stdout",true)

recipe = # <fill this>
out(recipe)

See the quickstart guide for more information on how to run Liquidsoap, on what is this out(..) operator, etc.

Live override

Sound processing

liquidsoap can be used to process / filter sound either in a streaming pipeline, or used "offline" to directly produce an audio output (file).

See https://www.liquidsoap.info/doc-1.4.2/reference.html#source-sound-processing


Links / Projects / Radio streams that use liquidsoap

  • Data Radio. Here a script created a day and night playlist, with a "fallback" to allow a live stream to interrupt.

playlist

playlist source

mode (of type string, which defaults to "randomize"): Play the files in the playlist either in the order (“normal” mode), or shuffle the playlist each time it is loaded, and play it in this order for a whole round (“randomize” mode), or pick a random file in the playlist each time (“random” mode).

say_metadata

say_metadata filter

outputs

Basic outputs of interest:

examples

liquidsoap 'out(noise())'
liquidsoap 'out(playlist("playlist.pls"))'
liquidsoap 'output.prefered(mksafe(playlist("playlist.pls")))'
liquidsoap 'output.file(%mp3,"output.mp3",mksafe(playlist("playlist.pls")))'

with playlist.pls:

brown.ogg

Observations:

  • WAV files don't seem to work, but ogg + mp3 seem OK! (or was this the stereo problem)
  • explicit output modules (like output.file) seem to require the use of mksafe (out doesn't need this).

Doesn't work with mono source material -- default seems to be stereo...

  [decoder:3] Unable to decode "./speech0001.mp3" as {audio=2;video=0;midi=0}!
  2020/05/11 17:42:04 [decoder.mad:3] File "./speech0003.mp3" has an incompatible number of channels.
  WAV file "speech0001.wav" has content type {audio=1;video=0;midi=0} but {audio=2;video=0;midi=0} was expected.


How would you output a mono audio stream?

Presentation

Recently presented at Fosdem2020 also on vimeo

Documentation conventions

The docs have cryptic syntax, for instance the say_metadata filter is described with the signature:

 (source(?A), ?pattern : string) -> source(?A)

Which means you can call this function like:

 say_metadata(mysource)

or

 say_metadata(mysource, pattern="")