Liquidsoap

From Seo Wiki - Search Engine Optimization and Programming Languages
Jump to navigationJump to search

Template:Multimedia-software-stub

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

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.

Design

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.

Streams

File:Stream.png
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("http://server.org:8000/stream")

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="server.org",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 ..)
end

# Redefine s and apply f
# to every metadata
s = on_metadata(f, s)

Dynamic

File:Liqgraph.png
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

If you like SEOmastering Site, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...