From Seo Wiki - Search Engine Optimization and Programming Languages

Jump to: navigation, search


Developer(s) The Savonet Team
Initial release 2003
Stable release 0.9.2 / October 30, 2009; 135620284 ago
Written in OCaml
Operating system Unix, Linux, Microsoft Windows and Mac OS X.
Development status Active
Type Streaming media
License GPL

Liquidsoap is an audio programming language developed initially to produce audio and video source streams sent to an Icecast server. The difference with other available tools is that Liquidsoap interprets a dedicated script language, which makes it very versatile and adaptable to a lot of various usages.

The recent releases of Liquidsoap also include the possibility to interact with the local sound card or to output multimedia data to local files using various formats. Thus, Liquidsoap is not only a source client for Icecast, but a general purpose specialized audio language dedicated to the automation of audio and video processing and streaming.

Liquidsoap is released under the GPL license, is part of the Savonet project, and is developed in OCaml. The Savonet project also provides OCaml modules used for the various features supported by Liquidsoap.



Describing an audio stream can be very complex: several inputs (files, stream relaying, sound card input) that can be combined in various ways (audio processing, mixing, track scheduling, fall-backs) and finally be output in various other ways (several servers, contents and formats). To make it easy without losing expressive power, Liquidsoap uses its own little scripting language for configuration.

That language has a notion of audio stream and request, and has built-in functions for combining streams in various ways. Some of its main features are:

  • It is statically typed: your stream never crashes because you made a typo in a dark corner of the configuration.
  • Types are inferred: you don’t have to write them.
  • It is functional: you can define your own compound operations, but functions are also used to describe transitions from one stream to another.


A stream in Liquidsoap

In the Liquidsoap language, audio and video streams are represented by variables. However, a stream is an infinite object, hence streams variable in Liquidsoap cannot be directly manipulated. Instead, they are processed through operators that wrap operations around them.

Additionally, a stream is a high-order object that represents an infinite sequence of audio or video data samples but also metadata and breaks which represent tracks limits.

For example, a stream can be defined from an external audio stream the following way:

s = input.http("")

Later, if the user wants to apply a volume change to this stream, he uses the amplify() operator:

s = amplify(2.0, s)

This code redefines the source s. The new source now has an amplification process applied to it, which will take the data from the original source, apply the amplification to it and pass it to the new source.

Eventually, the stream is passed to an output, which can be either a local output, to the sound card, a JACK server, a file, etc.., or an output to a distant server such as an Icecast server:

output.icecast.vorbis(host="",mount="my_radio", s)

A functional language

The Liquidsoap language is a functional language. Hence, functions can be used as variables. In particular, since streams are infinite objects, the only way to apply an operation on every element of the stream is to define a generic function that is applied to each element once it is generated.

For instance, you can define an operation on each metadata carried by the stream:

# A function to apply to each metadata
def f(m) =
  (.. Some operations on m ..)
# Redefine s and apply f
# to every metadata
s = on_metadata(f, s)


A graph generated by a script

When executing a script, Liquidsoap parses each operators and definitions. From these objects, it generates an oriented graph of operators whose roots are the sources and leafs the outputs.

This graph is executed on the reverse order: for each output, Liquidsoap asks for a complete frame of data. Then the output propagates this to the nodes below it, up to the roots of the graph where the source fills the frame.

During this execution, the same frame object is passed to each operators in the graph, allowing a minimal number of copies of the audio and video data, which is important to maintain a correct efficiency.

External links

Personal tools

Served in 0.196 secs.