Liquidsoap 1.1.1 : Language reference

Liquidsoap scripting language reference

Categories

The Source / ... categories contain all functions that return sources. The Input functions are those which build elementary sources (playing files, synthesizing sound, etc.). The Output functions are those which take a source and register it for being streamed to the outside (file, soundcard, audio server, etc.). The Visualization functions are experimental ones that let you visualize in real-time some aspects of the audio stream. The Sound Processing functions are those which basically work on the source as a continuous audio stream. They would typically be mixers of streams, audio effects or analysis. Finally, Track Processing functions are basically all others, often having a behaviour that depends on or affects the extra information that liquidsoap puts in streams: track limits and metadata.

Source / Conversions

audio_to_stereo
(?id:string,source(audio=*+1,video=0,midi=0))->
source(audio=2,video=0,midi=0)

Convert any kind of audio source into a stereo source.

drop_audio
(?id:string,source(audio='#a,video='#b,midi='#c))->
source(audio=0,video='#b,midi='#c)

Drop all audio channels of a stream.

drop_midi
(?id:string,source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi=0)

Drop all midi channels of a stream.

drop_video
(?id:string,source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video=0,midi='#c)

Drop all video channels of a stream.

id
(?id:string,source('a))->source('a)

Does not do anything, simply forwards its input stream.

mean
(?id:string,source(audio='#a,video='#b,midi='#c))->
source(audio=1,video='#b,midi='#c)

Produce mono audio by taking the mean of all audio channels.

mux_audio
(?id:string,audio:source(audio='#a,video=0,midi=0),
 source(audio=0,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

Mux an audio stream into an audio-free stream.

mux_mono
(?id:string,mono:source(audio=1,video=0,midi=0),
 source(audio='#a,video='#b,midi='#c))->
source(audio='#a+1,video='#b,midi='#c)

Mux a mono audio stream into another stream.

mux_stereo
(?id:string,stereo:source(audio=2,video=0,midi=0),
 source(audio='#a,video='#b,midi='#c))->
source(audio='#a+2,video='#b,midi='#c)

Mux a stereo audio stream into another stream.

mux_video
(?id:string,video:source(audio=0,video='#a,midi=0),
 source(audio='#b,video=0,midi='#c))->
source(audio='#b,video='#a,midi='#c)

Add video channnels to a stream.

swap
(?id:string,source(audio=2,video=0,midi=0))->
source(audio=2,video=0,midi=0)

Swap two channels of a stereo source.

Source / Input

blank
(?id:string,?duration:float)->source('a)

Produce silence and blank images.

empty
(?id:string)->source(audio='a,video='b,midi='c)

A source that does not produce anything. No silence, no track at all.

fail
(?id:string)->source('a)

Creates a source that fails to produce anything.

in
(?id:string,?start:bool,?on_start:(()->unit),
 ?on_stop:(()->unit),?fallible:bool)->
active_source(audio='#a+1,video='#b,midi='#c)

Create a source from the first available input driver in pulseaudio, portaudio, oss, alsa, blank.

input.alsa
(?id:string,?bufferize:bool,?clock_safe:bool,
 ?device:string,?fallible:bool,?on_start:(()->unit),
 ?on_stop:(()->unit),?start:bool)->
active_source(audio='#a+1,video=0,midi=0)

Stream from an ALSA input device.

input.external
(?id:string,?buffer:float,?channels:int,?max:float,
 ?restart:bool,?restart_on_error:bool,?samplerate:int,
 string)->source(audio='#a+1,video=0,midi=0)

Stream data from an external application.

input.gstreamer.audio
(?id:string,?max:float,?pipeline:string)->
source(audio='#a+1,video=0,midi=0)

Stream audio from a GStreamer pipeline.

input.gstreamer.audio_video
(?id:string,?audio_pipeline:string,?max:float,
 ?pipeline:string,?video_pipeline:string)->
source(audio=2,video=1,midi=0)

Stream audio+video from a GStreamer pipeline.

input.gstreamer.video
(?id:string,?max:float,?pipeline:string)->
source(audio=0,video=1,midi=0)

Stream video from a GStreamer pipeline.

input.harbor
(?id:string,?auth:((string,string)->bool),?buffer:float,
 ?debug:bool,?dumpfile:string,?icy:bool,
 ?icy_metadata_charset:string,?logfile:string,?max:float,
 ?metadata_charset:string,
 ?on_connect:(([(string*string)])->unit),
 ?on_disconnect:(()->unit),?password:string,?port:int,
 ?timeout:float,?user:string,string)->source('a)

Retrieves the given http stream from the harbor.

input.http
(?id:string,?autostart:bool,?bind_address:string,
 ?buffer:float,?debug:bool,?force_mime:string,
 ?logfile:string,?max:float,?new_track_on_metadata:bool,
 ?playlist_mode:string,?poll_delay:float,?timeout:float,
 ?user_agent:string,string)->source('a)

Forwards the given http stream. The relay can be paused/resumed using the start/stop telnet commands.

input.jack
(?id:string,?buffer_size:int,?clock_safe:bool,
 ?server:string)->source(audio='#a+1,video=0,midi=0)

Get stream from jack.

input.keyboard.sdl
(?id:string,?velocity:float)->
source(audio='#a,video=0,midi='#b+1)

WARNING: This is only EXPERIMENTAL!

Play notes from the keyboard.

input.lastfm
(?id:string,?autostart:bool,?bind_address:string,
 ?buffer:float,?debug:bool,?max:float,
 ?new_track_on_metadata:bool,password:string,
 ?poll_delay:float,?timeout:float,user:string,
 ?user_agent:string,string)->
source(audio=2,video=0,midi=0)

Forwards the given lastfm stream. The relay can be paused/resumed using the start/stop telnet commands.

input.oss
(?id:string,?clock_safe:bool,?device:string,
 ?fallible:bool,?on_start:(()->unit),?on_stop:(()->unit),
 ?start:bool)->active_source(audio='#a+1,video=0,midi=0)

Stream from an OSS input device.

input.portaudio
(?id:string,?buflen:int,?clock_safe:bool,?fallible:bool,
 ?on_start:(()->unit),?on_stop:(()->unit),?start:bool)->
source(audio='#a+1,video='#b,midi='#c)

Stream from a portaudio input device.

input.pulseaudio
(?id:string,?client:string,?clock_safe:bool,
 ?device:string,?fallible:bool,?fallible:bool,
 ?on_start:(()->unit),?on_start:(()->unit),
 ?on_stop:(()->unit),?on_stop:(()->unit),?start:bool,
 ?start:bool)->
active_source(audio='#a+1,video='#b,midi='#c)

Stream from a portaudio input device.

input.udp
(?id:string,?buffer:float,host:string,port:int,string)->
active_source('a)

WARNING: This is only EXPERIMENTAL!

Input encoded data from UDP, without any control whatsoever.

noise
(?id:string,?duration:float)->
source(audio='a,video='b,midi=0)

Generate white noise.

playlist
(?id:string,?conservative:bool,?default_duration:float,
 ?length:float,?mime_type:string,?mode:string,
 ?prefix:string,?reload:int,?reload_mode:string,
 ?timeout:float,string)->source('a)

Loop on a playlist of URIs.

playlist.once
(?id:string,?random:bool,?on_done:(()->unit),
 ?reload_mode:string,string)->source('a)

Custom playlist source written using the script language. Will read directory or playlist, play all files and stop

playlist.reloadable
(?id:string,?random:bool,?on_done:(()->unit),string)->
(((?uri:string)->unit)*source('a))

Custom playlist source written using the script language. Will read directory or playlist, play all files and stop. Returns a pair (reload,source) where reload is a function of type (?uri:string)->unit used to reload the source and source is the actual source. The reload function can optionally be called with a new playlist URI. Otherwise, it reloads the previous URI.

playlist.safe
(?id:string,?mime_type:string,?mode:string,
 ?prefix:string,?reload:int,?reload_mode:string,string)->
source('a)

Loop on a playlist of local files, and never fail. In order to do so, it has to check every file at the loading, so the streamer startup may take a few seconds. To avoid this, use a standard playlist, and put only a few local files in a default safe_playlist in order to ensure the liveness of the streamer.

request.dynamic
(?id:string,?conservative:bool,?default_duration:float,
 ?length:float,?timeout:float,(()->request('a)))->
source('a)

Play request dynamically created by a given function.

request.equeue
(?id:string,?conservative:bool,?default_duration:float,
 ?length:float,?timeout:float)->source('a)

Receive URIs from users, and play them. Insertion and deletion possible at any position.

request.queue
(?id:string,?conservative:bool,?default_duration:float,
 ?interactive:bool,?length:float,?queue:[request('a)],
 ?timeout:float)->source('a)

Receive URIs from users, and play them.

saw
(?id:string,?amplitude:float,?duration:float,?float)->
source(audio='#a+1,video=0,midi=0)

Generate a saw wave.

sine
(?id:string,?amplitude:float,?duration:float,?float)->
source(audio='#a+1,video=0,midi=0)

Generate a sine wave.

single
(?id:string,?conservative:bool,?default_duration:float,
 ?length:float,?timeout:float,string)->source('a)

Loop on a request. It never fails if the request is static, meaning that it can be fetched once. Typically, http, ftp, say requests are static, and time is not.

square
(?id:string,?amplitude:float,?duration:float,?float)->
source(audio='#a+1,video=0,midi=0)

Generate a square wave.

Source / Liquidsoap

buffer
(?id:string,?buffer:float,?fallible:bool,?max:float,
 ?on_start:(()->unit),?on_stop:(()->unit),?start:bool,
 source('a))->source('a)

Create a buffer between two different clocks.

Source / MIDI Processing

midi.chord
(?id:string,?metadata:string,
 source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c+1)

Generate a chord.

midi.merge_all
(?id:string,?track_out:int,
 source(audio='#a,video='#b,midi='#c+1))->
source(audio='#a,video='#b,midi='#c+1)

Merge all MIDI tracks in one.

midi.remove
(?id:string,[int],source(audio='#a,video='#b,midi='#c+1))->
source(audio='#a,video='#b,midi='#c+1)

Remove MIDI tracks.

Source / Output

out
(source(audio='#a+1,video='#b,midi='#c))->
active_source(audio='#a+1,video='#b,midi='#c)

Output a stream using the 'output.prefered' operator. The input source does not need to be infallible, blank will just be played during failures.

output.alsa
(?id:string,?bufferize:bool,?clock_safe:bool,
 ?device:string,?fallible:bool,?on_start:(()->unit),
 ?on_stop:(()->unit),?start:bool,
 source(audio='#a+1,video='#b,midi='#c))->
active_source(audio='#a+1,video='#b,midi='#c)

Output the source's stream to an ALSA output device.

output.ao
(?id:string,?buffer_size:int,?channels_matrix:string,
 ?clock_safe:bool,?driver:string,?fallible:bool,
 ?on_start:(()->unit),?on_stop:(()->unit),
 ?options:[(string*string)],?start:bool,
 source(audio='#a+1,video='#b,midi='#c))->
active_source(audio='#a+1,video='#b,midi='#c)

Output stream to local sound card using libao.

output.dummy
(?id:string,?fallible:bool,?on_start:(()->unit),
 ?on_stop:(()->unit),?start:bool,source('a))->
active_source('a)

Dummy output for debugging purposes.

output.external
(?id:string,?fallible:bool,?flush:bool,
 ?on_start:(()->unit),?on_stop:(()->unit),
 ?reopen_delay:float,?reopen_on_metadata:bool,
 ?reopen_when:(()->bool),?start:bool,format('a),string,
 source('a))->active_source('a)

Send the stream to a process' standard input.

output.file
(?id:string,?append:bool,?dir_perm:int,?fallible:bool,
 ?flush:bool,?on_close:((string)->unit),
 ?on_start:(()->unit),?on_stop:(()->unit),?perm:int,
 ?reopen_delay:float,?reopen_on_metadata:bool,
 ?reopen_when:(()->bool),?start:bool,format('a),string,
 source('a))->active_source('a)

Output the source stream to a file.

output.graphics
(?id:string,?fallible:bool,?on_start:(()->unit),
 ?on_stop:(()->unit),?start:bool,
 source(audio=0,video=1,midi=0))->
active_source(audio=0,video=1,midi=0)

Display video stream using the Graphics library.

output.gstreamer.audio
(?id:string,?clock_safe:bool,?fallible:bool,
 ?on_start:(()->unit),?on_stop:(()->unit),
 ?pipeline:string,?start:bool,
 source(audio='#a+1,video='#b,midi='#c))->
active_source(audio='#a+1,video='#b,midi='#c)

Output stream to a GStreamer pipeline.

output.gstreamer.audio_video
(?id:string,?asynchronous:bool,?audio_pipeline:string,
 ?blocking:bool,?clock_safe:bool,?fallible:bool,
 ?on_start:(()->unit),?on_stop:(()->unit),
 ?pipeline:string,?start:bool,?video_pipeline:string,
 source(audio='#a+1,video='#b+1,midi='#c))->
active_source(audio='#a+1,video='#b+1,midi='#c)

Output stream to a GStreamer pipeline.

output.gstreamer.video
(?id:string,?clock_safe:bool,?fallible:bool,
 ?on_start:(()->unit),?on_stop:(()->unit),
 ?pipeline:string,?start:bool,
 source(audio='#a,video='#b+1,midi='#c))->
active_source(audio='#a,video='#b+1,midi='#c)

Output stream to a GStreamer pipeline.

output.harbor
(?id:string,?auth:((string,string)->bool),?buffer:int,
 ?burst:int,?chunk:int,?dumpfile:string,?encoding:string,
 ?fallible:bool,?format:string,
 ?headers:[(string*string)],?icy_metadata:string,
 ?metaint:int,mount:string,
 ?on_connect:((headers:[(string*string)],uri:string,
               protocol:string,string)->unit),
 ?on_disconnect:((string)->unit),?on_start:(()->unit),
 ?on_stop:(()->unit),?password:string,?port:int,
 ?protocol:string,?start:bool,?timeout:float,?url:string,
 ?user:string,format('a),source('a))->active_source('a)

Encode and output the stream using the harbor server.

output.icecast
(?id:string,?connection_timeout:float,
 ?description:string,?dumpfile:string,?encoding:string,
 ?fallible:bool,?format:string,?genre:string,
 ?headers:[(string*string)],?host:string,
 ?icy_metadata:string,?mount:string,?name:string,
 ?on_connect:(()->unit),?on_disconnect:(()->unit),
 ?on_error:((string)->float),?on_start:(()->unit),
 ?on_stop:(()->unit),?password:string,?port:int,
 ?protocol:string,?public:bool,?start:bool,
 ?timeout:float,?url:string,?user:string,format('a),
 source('a))->active_source('a)

Encode and output the stream to an icecast2 or shoutcast server.

output.jack
(?id:string,?buffer_size:int,?clock_safe:bool,
 ?fallible:bool,?on_start:(()->unit),?on_stop:(()->unit),
 ?server:string,?start:bool,
 source(audio='#a+1,video=0,midi=0))->
active_source(audio='#a+1,video=0,midi=0)

Output stream to jack.

output.oss
(?id:string,?clock_safe:bool,?device:string,
 ?fallible:bool,?on_start:(()->unit),?on_stop:(()->unit),
 ?start:bool,source(audio='#a+1,video='#b,midi='#c))->
active_source(audio='#a+1,video='#b,midi='#c)

Output the source's stream to an OSS output device.

output.portaudio
(?id:string,?buflen:int,?clock_safe:bool,?fallible:bool,
 ?on_start:(()->unit),?on_stop:(()->unit),?start:bool,
 source(audio='#a+1,video='#b,midi='#c))->
active_source(audio='#a+1,video='#b,midi='#c)

Output the source's stream to a portaudio output device.

output.prefered
(?id:string,?fallible:bool,?on_start:(()->unit),
 ?on_stop:(()->unit),?start:bool,
 source(audio='#a+1,video='#b,midi='#c))->
active_source(audio='#a+1,video='#b,midi='#c)

Output to local audio card using the first available driver in pulseaudio, portaudio, oss, alsa, ao, dummy.

output.pulseaudio
(?id:string,?client:string,?clock_safe:bool,
 ?device:string,?fallible:bool,?on_start:(()->unit),
 ?on_stop:(()->unit),?start:bool,
 source(audio='#a+1,video='#b,midi='#c))->
active_source(audio='#a+1,video='#b,midi='#c)

Output the source's stream to a portaudio output device.

output.sdl
(?id:string,?fallible:bool,?on_start:(()->unit),
 ?on_stop:(()->unit),?start:bool,
 source(audio=0,video=1,midi=0))->
active_source(audio=0,video=1,midi=0)

Display a video using SDL.

output.udp
(?id:string,?fallible:bool,host:string,
 ?on_start:(()->unit),?on_stop:(()->unit),port:int,
 ?start:bool,format('a),source('a))->active_source('a)

WARNING: This is only EXPERIMENTAL!

Output encoded data to UDP, without any control whatsoever.

Source / Sound Processing

add
(?id:string,?normalize:bool,?weights:[int],
 [source(audio='#a,video='#b,midi=0)])->
source(audio='#a,video='#b,midi=0)

Mix sources, with optional normalization. Only relay metadata from the first source that is effectively summed.

amplify
(?id:string,?override:string,'a,
 source(audio='#b,video='#c,midi='#d))->
source(audio='#b,video='#c,midi='#d)
where 'a is either float or ()->float

Multiply the amplitude of the signal.

bpm
(?id:string,?every:float,((float)->unit),
 source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

Detect the BPM.

clip
(?id:string,?max:float,?min:float,
 source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

Clip sound.

comb
(?id:string,?delay:float,?feedback:'a,
 source(audio='#b,video='#c,midi='#d))->
source(audio='#b,video='#c,midi='#d)
where 'a is either float or ()->float

Comb filter.

compand
(?id:string,?mu:float,
 source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

Compand the signal

compress
(?id:string,?attack:'a,?gain:'b,?knee:'c,?ratio:float,
 ?release:'d,?rms_window:float,?threshold:'e,
 source(audio='#f,video='#g,midi='#h))->
source(audio='#f,video='#g,midi='#h)
where 'a, 'b, 'c, 'd, 'e is either float or ()->float

Compress the signal.

compress.exponential
(?id:string,?mu:float,
 source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

Exponential compressor.

cross
(?id:string,?active:bool,?conservative:bool,
 ?duration:float,?inhibit:float,?minimum:float,
 ?override:string,((source('a),source('a))->source('a)),
 source('a))->source('a)

Generic cross operator, allowing the composition of the N last seconds of a track with the beginning of the next track.

echo
(?id:string,?delay:'a,?feedback:'b,?ping_pong:bool,
 source(audio='#c,video='#d,midi='#e))->
source(audio='#c,video='#d,midi='#e)
where 'a, 'b is either float or ()->float

Add echo.

fade.final
(?id:string,?duration:float,?override:string,
 ?type:string,source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

Fade a stream to silence.

fade.in
(?id:string,?duration:float,?override:string,
 ?type:string,source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

Fade the beginning of tracks. A special override metadata field can be used to set the duration for a specific track (float in seconds).

fade.initial
(?id:string,?duration:float,?type:string,
 source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

Fade the beginning of a stream.

fade.out
(?id:string,?duration:float,?override:string,
 ?type:string,source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

Fade the end of tracks. A special override metadata field can be used to set the duration for a specific track (float in seconds).

filter
(?id:string,freq:'a,mode:string,?q:'b,?wetness:'c,
 source(audio='#d,video='#e,midi='#f))->
source(audio='#d,video='#e,midi='#f)
where 'a, 'b, 'c is either float or ()->float

Perform several kinds of filtering on the signal

filter.fir
(?id:string,beta:float,?coeffs:int,frequency:float,
 source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

Low-pass FIR filter.

filter.iir.butterworth.bandpass
(?id:string,frequency1:float,frequency2:float,?order:int,
 source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

IIR filter

filter.iir.butterworth.bandstop
(?id:string,frequency1:float,frequency2:float,?order:int,
 source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

IIR filter

filter.iir.butterworth.high
(?id:string,frequency:float,?order:int,
 source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

IIR filter

filter.iir.butterworth.low
(?id:string,frequency:float,?order:int,
 source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

IIR filter

filter.iir.eq.allpass
(?id:string,?bandwidth:float,frequency:float,
 source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

All pass biquad filter.

filter.iir.eq.bandpass
(?id:string,frequency:float,?q:float,
 source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

Band pass biquad filter.

filter.iir.eq.high
(?id:string,frequency:float,?q:float,
 source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

High pass biquad filter.

filter.iir.eq.highshelf
(?id:string,frequency:float,?slope:float,
 source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

High shelf biquad filter.

filter.iir.eq.low
(?id:string,frequency:float,?q:float,
 source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

Low pass biquad filter.

filter.iir.eq.lowshelf
(?id:string,frequency:float,?slope:float,
 source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

Low shelf biquad filter.

filter.iir.eq.notch
(?id:string,frequency:float,?q:float,
 source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

Band pass biquad filter.

filter.iir.eq.peak
(?id:string,frequency:float,?gain:float,?q:float,
 source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

Peak EQ biquad filter.

filter.iir.resonator.allpass
(?id:string,frequency:float,?q:float,
 source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

IIR filter

filter.iir.resonator.bandpass
(?id:string,frequency:float,?q:float,
 source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

IIR filter

filter.iir.resonator.bandstop
(?id:string,frequency:float,?q:float,
 source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

IIR filter

flanger
(?id:string,?delay:float,?feedback:'a,?freq:'b,?phase:'c,
 source(audio='#d,video='#e,midi='#f))->
source(audio='#d,video='#e,midi='#f)
where 'a, 'b, 'c is either float or ()->float

Flanger effect.

helium
(source(audio='#a+1,video=0,midi=0))->
source(audio='#a+1,video=0,midi=0)

Increases the pitch, making voices sound like on helium.

ladspa.amp_mono
(?id:string,?gain:'a,
 source(audio='#b,video='#c,midi='#d))->
source(audio='#b,video='#c,midi='#d)
where 'a is either float or ()->float

Mono Amplifier by Richard Furse (LADSPA example plugins).

ladspa.amp_stereo
(?id:string,?gain:'a,source(audio=2,video=0,midi=0))->
source(audio=2,video=0,midi=0)
where 'a is either float or ()->float

Stereo Amplifier by Richard Furse (LADSPA example plugins).

ladspa.delay_5s
(?id:string,?delay:'a,?dry_wet_balance:'b,
 source(audio='#c,video='#d,midi='#e))->
source(audio='#c,video='#d,midi='#e)
where 'a, 'b is either float or ()->float

Simple Delay Line by Richard Furse (LADSPA example plugins).

ladspa.hpf
(?id:string,?cutoff_frequency:'a,
 source(audio='#b,video='#c,midi='#d))->
source(audio='#b,video='#c,midi='#d)
where 'a is either float or ()->float

Simple High Pass Filter by Richard Furse (LADSPA example plugins).

ladspa.lpf
(?id:string,?cutoff_frequency:'a,
 source(audio='#b,video='#c,midi='#d))->
source(audio='#b,video='#c,midi='#d)
where 'a is either float or ()->float

Simple Low Pass Filter by Richard Furse (LADSPA example plugins).

ladspa.noise_white
(?id:string,?amplitude:'a)->
source(audio='#b,video='#c,midi='#d)
where 'a is either float or ()->float

White Noise Source by Richard Furse (LADSPA example plugins).

ladspa.sine_faac
(?id:string,?amplitude:'a,
 source(audio='#b,video='#c,midi='#d))->
source(audio='#b,video='#c,midi='#d)
where 'a is either float or ()->float

Sine Oscillator (Freq:audio, Amp:control) by Richard Furse (LADSPA example plugins).

ladspa.sine_fcaa
(?id:string,?frequency:'a,
 source(audio='#b,video='#c,midi='#d))->
source(audio='#b,video='#c,midi='#d)
where 'a is either float or ()->float

Sine Oscillator (Freq:control, Amp:audio) by Richard Furse (LADSPA example plugins).

ladspa.sine_fcac
(?id:string,?amplitude:'a,?frequency:'b)->
source(audio='#c,video='#d,midi='#e)
where 'a, 'b is either float or ()->float

Sine Oscillator (Freq:control, Amp:control) by Richard Furse (LADSPA example plugins).

limit
(?id:string,?attack:'a,?gain:'b,?knee:'c,?ratio:float,
 ?release:'d,?rms_window:float,?threshold:'e,
 source(audio='#f,video='#g,midi='#h))->
source(audio='#f,video='#g,midi='#h)
where 'a, 'b, 'c, 'd, 'e is either float or ()->float

Limit the signal.

mic_filter
(source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

Remove low frequencies often produced by microphones.

mix
(?id:string,[source(audio='#a,video='#b,midi='#c)])->
source(audio='#a,video='#b,midi='#c)

Mixing table controllable via the telnet interface.

normalize
(?id:string,?gain_max:'a,?gain_min:'b,?k_down:'c,
 ?k_up:'d,?target:'e,?threshold:'f,?window:float,
 source(audio='#g,video='#h,midi='#i))->
source(audio='#g,video='#h,midi='#i)
where 'a, 'b, 'c, 'd, 'e, 'f is either float or ()->float

Normalize the signal. Dynamic normalization of the signal is sometimes the only option, and can make a listening experience much nicer. However, its dynamic aspect implies some limitations which can go as far as creating saturation in some extreme cases. If possible, consider using some track-based normalization techniques such as those based on replay gain. See the documentation for more details.

nrj
(source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

Compress and normalize, producing a more uniform and “full” sound.

sky
(source(audio='#a,video='#b,midi=0))->
source(audio='#a,video='#b,midi=0)

Multiband-compression.

smart_cross
(?id:string,?active:bool,?conservative:bool,
 ?duration:float,?inhibit:float,?minimum:float,
 ?width:float,
 ((float,float,[(string*string)],[(string*string)],
   source(audio='#a+1,video=0,midi=0),
   source(audio='#a+1,video=0,midi=0))->
  source(audio='#a+1,video=0,midi=0)),
 source(audio='#a+1,video=0,midi=0))->
source(audio='#a+1,video=0,midi=0)

Cross operator, allowing the composition of the N last seconds of a track with the beginning of the next track, using a transition function depending on the relative power of the signal before and after the end of track.

soundtouch
(?id:string,?pitch:'a,?rate:'b,?tempo:'c,
 source(audio='#d+1,video=0,midi=0))->
source(audio='#d+1,video=0,midi=0)
where 'a, 'b, 'c is either float or ()->float

WARNING: This is only EXPERIMENTAL!

Change the rate, the tempo or the pitch of the sound.

stereo.ms.decode
(?id:string,?width:float,source(audio=2,video=0,midi=0))->
source(audio=2,video=0,midi=0)

Decode mid+side stereo (M/S) to left+right stereo.

stereo.ms.encode
(?id:string,source(audio=2,video=0,midi=0))->
source(audio=2,video=0,midi=0)

Encode left+right stereo to mid+side stereo (M/S).

stereo.pan
(?id:string,?field:'a,?pan:'b,
 source(audio=2,video=0,midi=0))->
source(audio=2,video=0,midi=0)
where 'a, 'b is either float or ()->float

Pan a stereo sound.

stretch
(?id:string,?active:bool,ratio:'a,
 source(audio='#b+1,video=0,midi=0))->
source(audio='#c+1,video=0,midi=0)
where 'a is either float or ()->float

Slow down or accelerate an audio stream by stretching (sounds lower) or squeezing it (sounds higher).

Source / Sound Synthesis

dssi.register
(string)->unit

Resgister a DSSI plugin.

synth.all.saw
(?id:string,?attack:float,?decay:float,?envelope:bool,
 ?release:float,?sustain:float,
 source(audio='#a+1,video='#b,midi='#c+16))->
source(audio='#a+1,video='#b,midi='#c+16)

Saw synthesizer. It creates one synthesizer for each channel.

synth.all.sine
(?id:string,?attack:float,?decay:float,?envelope:bool,
 ?release:float,?sustain:float,
 source(audio='#a+1,video='#b,midi='#c+16))->
source(audio='#a+1,video='#b,midi='#c+16)

Sine synthesizer. It creates one synthesizer for each channel.

synth.all.square
(?id:string,?attack:float,?decay:float,?envelope:bool,
 ?release:float,?sustain:float,
 source(audio='#a+1,video='#b,midi='#c+16))->
source(audio='#a+1,video='#b,midi='#c+16)

Square synthesizer. It creates one synthesizer for each channel.

synth.saw
(?id:string,?attack:float,?channel:int,?decay:float,
 ?envelope:bool,?release:float,?sustain:float,
 ?volume:float,source(audio='#a+1,video='#b,midi='#c+1))->
source(audio='#a+1,video='#b,midi='#c+1)

Saw synthesizer.

synth.sine
(?id:string,?attack:float,?channel:int,?decay:float,
 ?envelope:bool,?release:float,?sustain:float,
 ?volume:float,source(audio='#a+1,video='#b,midi='#c+1))->
source(audio='#a+1,video='#b,midi='#c+1)

Sine synthesizer.

synth.square
(?id:string,?attack:float,?channel:int,?decay:float,
 ?envelope:bool,?release:float,?sustain:float,
 ?volume:float,source(audio='#a+1,video='#b,midi='#c+1))->
source(audio='#a+1,video='#b,midi='#c+1)

Square synthesizer.

Source / Track Processing

append
(?id:string,?insert_missing:bool,?merge:bool,source('a),
 (([(string*string)])->source('a)))->source('a)

Append an extra track to every track. Set the metadata 'liq_append' to 'false' to inhibit appending on one track.

at
((()->bool),source('a))->source('a)

Restrict a source to play only when a predicate is true.

crossfade
(?id:string,?conservative:bool,?start_next:float,
 ?fade_in:float,?fade_out:float,
 source(audio='#a,video='#b,midi=0))->
source(audio='#a,video='#b,midi=0)

Simple crossfade.

cue_cut
(?id:string,?cue_in_metadata:string,
 ?cue_out_metadata:string,
 source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

Start track after a cue in point and stop it at cue out point. The cue points are given as metadata, in seconds from the begining of tracks.

delay
(?id:string,?initial:bool,float,source('a))->source('a)

Prevents the child from being ready again too fast after a end of track

drop_metadata
(source('a))->source('a)

Removes all metadata coming from a source.

eat_blank
(?id:string,?at_beginning:bool,?max_blank:float,
 ?min_noise:float,?threshold:float,?track_sensitive:bool,
 source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

Eat blanks, i.e., drop the contents of the stream until it is not blank anymore.

fallback
(?id:string,?replay_metadata:bool,?track_sensitive:bool,
 ?transitions:[(source('a),source('a))->source('a)],
 [source('a)])->source('a)

At the beginning of each track, select the first ready child.

fallback.skip
(input:source('a),source('a))->source('a)

Special track insensitive fallback that always skips current song before switching.

insert_metadata
(?id:string,source('a))->
((([(string*string)])->unit)*source('a))

Dynamically insert metadata in a stream. Returns a pair (f,s) where s is a new source and f is a function of type (metadata)->unit, used to insert metadata in s.

map_metadata
(?id:string,?insert_missing:bool,?strip:bool,
 ?update:bool,(([(string*string)])->[(string*string)]),
 source('a))->source('a)

Rewrite metadata on the fly using a function.

merge_tracks
(source('a))->source('a)

Merge all tracks from a source.

mksafe
(source('a))->source('a)

Turn a source into an infaillible source. by adding blank when the source is not available.

on_blank
(?id:string,?max_blank:float,?min_noise:float,
 ?on_noise:(()->unit),?threshold:float,
 ?track_sensitive:bool,(()->unit),
 source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

Calls a given handler when detecting a blank.

on_end
(?id:string,?delay:float,
 ((float,[(string*string)])->unit),source('a))->
source('a)

Call a given handler when there is less than a given amount of time remaining before then end of track.

on_metadata
(?id:string,(([(string*string)])->unit),source('a))->
source('a)

Call a given handler on metadata packets.

on_track
(?id:string,(([(string*string)])->unit),source('a))->
source('a)

Call a given handler on new tracks.

once
(source('a))->source('a)

Creates a source that plays only one track of the input source.

prepend
(?id:string,?merge:bool,
 source(audio='#a,video='#b,midi='#c),
 (([(string*string)])->
  source(audio='#a,video='#b,midi='#c)))->
source(audio='#a,video='#b,midi='#c)

Prepend an extra track before every track. Set the metadata 'liq_prepend' to 'false' to inhibit prepending on one track.

random
(?id:string,?replay_metadata:bool,?track_sensitive:bool,
 ?transitions:[(source('a),source('a))->source('a)],
 ?weights:[int],[source('a)])->source('a)

At the beginning of every track, select a random ready child.

rewrite_metadata
([(string*string)],?insert_missing:bool,?update:bool,
 ?strip:bool,source('a))->source('a)

Rewrite metadata on the fly using a list of (target,rules).

rotate
(?id:string,?replay_metadata:bool,?track_sensitive:bool,
 ?transitions:[(source('a),source('a))->source('a)],
 ?weights:[int],[source('a)])->source('a)

Rotate between the sources.

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

Append speech-synthesized tracks reading the metadata.

sequence
(?id:string,?merge:bool,[source('a)])->source('a)

Play only one track of every successive source, except for the last one which is played as much as available. Sources are released after being used, allowing them to shutdown cleanly and free their resources.

server.insert_metadata
(?id:string,source('a))->source('a)

Register a server/telnet command to update a source's metadata. Returns a new source, which will receive the updated metadata. The command has the following format: insert key1=“val1”,key2=“val2”,...

skip_blank
(?id:string,?threshold:float,?max_blank:float,
 ?min_noise:float,?track_sensitive:bool,
 source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

Skip track when detecting a blank.

smart_crossfade
(?start_next:float,?fade_in:float,?fade_out:float,
 ?default:((source(audio='#a+1,video=0,midi=0),
            source(audio='#a+1,video=0,midi=0))->
           source(audio='#a+1,video=0,midi=0)),
 ?high:float,?medium:float,?margin:float,?width:float,
 ?conservative:bool,source(audio='#a+1,video=0,midi=0))->
source(audio='#a+1,video=0,midi=0)

Crossfade between tracks, taking the respective volume levels into account in the choice of the transition.

smooth_add
(?delay:float,?p:float,
 normal:source(audio='#a,video='#b,midi=0),
 special:source(audio='#a,video='#b,midi=0))->
source(audio='#a,video='#b,midi=0)

Mixes two streams, with faded transitions between the state when only the normal stream is available and when the special stream gets added on top of it.

source.dynamic
(?id:string,(()->[source('a)]))->source('a)

WARNING: This is only EXPERIMENTAL!

Dynamically change the underlying source.

store_metadata
(?id:string,?size:int,source('a))->source('a)

Keep track of the last N metadata packets in the stream, and make the history available via a server command.

strip_blank
(?id:string,?max_blank:float,?min_noise:float,
 ?threshold:float,?track_sensitive:bool,
 source(audio='#a,video='#b,midi='#c))->
source(audio='#a,video='#b,midi='#c)

Make the source unavailable when it is streaming blank.

switch
(?id:string,?replay_metadata:bool,?single:[bool],
 ?track_sensitive:bool,
 ?transitions:[(source('a),source('a))->source('a)],
 [((()->bool)*source('a))])->source('a)

At the beginning of a track, select the first source whose predicate is true.

Source / Video Processing

video.add_text.gd
(?id:string,?color:int,?cycle:bool,?font:string,
 ?metadata:string,?size:int,?speed:int,?x:int,?y:int,'a,
 source(audio='#b,video='#c+1,midi='#d))->
source(audio='#b,video='#c+1,midi='#d)
where 'a is either string or ()->string

Display a text (using the SDL library).

video.add_text.gstreamer
(?id:string,?color:int,?cycle:bool,?font:string,
 ?metadata:string,?size:int,?speed:int,?x:int,?y:int,'a,
 source(audio='#b,video='#c+1,midi='#d))->
source(audio='#b,video='#c+1,midi='#d)
where 'a is either string or ()->string

Display a text (using the SDL library).

video.add_text.sdl
(?id:string,?color:int,?cycle:bool,?font:string,
 ?metadata:string,?size:int,?speed:int,?x:int,?y:int,'a,
 source(audio='#b,video='#c+1,midi='#d))->
source(audio='#b,video='#c+1,midi='#d)
where 'a is either string or ()->string

Display a text (using the SDL library).

video.fade.final
(?id:string,?duration:float,?transition:string,
 ?type:string,source(audio='#a,video='#b+1,midi='#c))->
source(audio='#a,video='#b+1,midi='#c)

Fade a stream to black.

video.fade.in
(?id:string,?duration:float,?override:string,
 ?transition:string,?type:string,
 source(audio='#a,video='#b+1,midi='#c))->
source(audio='#a,video='#b+1,midi='#c)

Fade the beginning of tracks. Metadata 'liq_video_fade_in' can be used to set the duration for a specific track (float in seconds).

video.fade.initial
(?id:string,?duration:float,?transition:string,
 ?type:string,source(audio='#a,video='#b+1,midi='#c))->
source(audio='#a,video='#b+1,midi='#c)

Fade the beginning of a stream.

video.fade.out
(?id:string,?duration:float,?override:string,
 ?transition:string,?type:string,
 source(audio='#a,video='#b+1,midi='#c))->
source(audio='#a,video='#b+1,midi='#c)

Fade the end of tracks. Metadata 'liq_video_fade_out' can be used to set the duration for a specific track (float in seconds).

video.fill
(?id:string,?color:int,
 source(audio='#a,video='#b+1,midi='#c))->
source(audio='#a,video='#b+1,midi='#c)

Fill frame with a color.

video.greyscale
(?id:string,source(audio='#a,video='#b+1,midi='#c))->
source(audio='#a,video='#b+1,midi='#c)

Convert video to greyscale.

video.invert
(?id:string,source(audio='#a,video='#b+1,midi='#c))->
source(audio='#a,video='#b+1,midi='#c)

Invert video.

video.lomo
(?id:string,source(audio='#a,video='#b+1,midi='#c))->
source(audio='#a,video='#b+1,midi='#c)

Emulate the “Lomo effect”.

video.opacity
(?id:string,float,source(audio='#a,video='#b+1,midi='#c))->
source(audio='#a,video='#b+1,midi='#c)

Scale opacity of video.

video.opacity.blur
(?id:string,source(audio='#a,video='#b+1,midi='#c))->
source(audio='#a,video='#b+1,midi='#c)

Blur opacity of video.

video.rotate
(?id:string,?angle:'a,?speed:'b,
 source(audio='#c,video='#d+1,midi='#e))->
source(audio='#c,video='#d+1,midi='#e)
where 'a, 'b is either float or ()->float

Rotate video.

video.scale
(?id:string,?scale:float,?x:int,?xscale:float,?y:int,
 ?yscale:float,source(audio='#a,video='#b+1,midi='#c))->
source(audio='#a,video='#b+1,midi='#c)

Scale and translate video.

video.sepia
(?id:string,source(audio='#a,video='#b+1,midi='#c))->
source(audio='#a,video='#b+1,midi='#c)

Convert video to sepia.

video.tile
(?id:string,?normalize:bool,?proportional:bool,
 ?weights:[int],[source(audio='#a,video='#b+1,midi='#c)])->
source(audio='#a,video='#b+1,midi='#c)

Tile sources (same as add but produces tiles of videos).

video.transparent
(?id:string,?color:int,?precision:float,
 source(audio='#a,video='#b+1,midi='#c))->
source(audio='#a,video='#b+1,midi='#c)

Set a color to be transparent.

Source / Visualization

rms
(?id:string,source(audio='#a+1,video='#b,midi='#c))->
((()->float)*source(audio='#a+1,video='#b,midi='#c))

Get current audio RMS volume of the source. Returns a pair (f,s) where s is a new source and f is a function of type () -> float and returns the current RMS of the source.

server.rms
(?id:string,source(audio='#a+1,video='#b,midi='#c))->
source(audio='#a+1,video='#b,midi='#c)

Register a command that outputs the RMS of the returned source.

video.volume
(?id:string,source(audio='#a+1,video=0,midi=0))->
source(audio='#a+1,video=1,midi=0)

Graphical visualization of the sound.

visu.volume
(?id:string,source(audio='#a+1,video=0,midi=0))->
source(audio='#a+1,video=0,midi=0)

Graphical visualization of the volume.

vumeter
(?id:string,?scroll:bool,
 source(audio='#a+1,video='#b,midi='#c))->
source(audio='#a+1,video='#b,midi='#c)

VU meter (display the audio volume).

Bool

!=
('a,'a)->bool where 'a is an orderable type

Comparison of comparable values.

<
('a,'a)->bool where 'a is an orderable type

Comparison of comparable values.

<=
('a,'a)->bool where 'a is an orderable type

Comparison of comparable values.

==
('a,'a)->bool where 'a is an orderable type

Comparison of comparable values.

>
('a,'a)->bool where 'a is an orderable type

Comparison of comparable values.

>=
('a,'a)->bool where 'a is an orderable type

Comparison of comparable values.

and
(bool,bool)->bool

Return the conjunction of its arguments

not
(bool)->bool

Returns the negation of its argument.

or
(bool,bool)->bool

Return the disjunction of its arguments

random.bool
()->bool

Generate a random value.

Control

add_timeout
(?fast:bool,float,(()->float))->unit

Call a function in N seconds. If the result of the function is positive or null, the task will be scheduled again after this amount of time (in seconds).

ignore
('a)->unit

Convert anything to unit, preventing warnings.

Interaction

add_skip_command
(source('a))->unit

Add a skip function to a source when it does not have one by default

audioscrobbler.nowplaying
(user:string,password:string,?host:string,?port:int,
 ?length:bool,[(string*string)])->unit

Submit a now playing song using the audioscrobbler protocol.

audioscrobbler.submit
(?source:string,user:string,password:string,?host:string,
 ?port:int,?length:bool,[(string*string)])->unit

Submit a played song using the audioscrobbler protocol.

http.get
(?headers:[(string*string)],?timeout:float,string)->
((((string*int)*string)*[(string*string)])*string)

Perform a full Http GET request and return (status,headers),data.

http.post
(?data:string,?headers:[(string*string)],?timeout:float,
 string)->
((((string*int)*string)*[(string*string)])*string)

Perform a full Http POST request and return (status,headers),data.

icy.update_metadata
(?host:string,?port:int,?user:string,?password:string,
 mount:string,?protocol:string,?encoding:string,
 ?headers:[(string*string)],[(string*string)])->unit

Update metata on an icecast mountpoint using the ICY protocol.

interactive.bool
(string,bool)->()->bool

Read a boolean from an interactive input.

interactive.float
(string,float)->()->float

Read a float from an interactive input.

interactive.string
(string,string)->()->string

Read a string from an interactive input.

osc.bool
(string,bool)->()->bool

Read from an OSC path.

osc.float
(string,float)->()->float

Read from an OSC path.

osc.float_pair
(string,(float*float))->()->(float*float)

Read from an OSC path.

osc.on_bool
(string,((bool)->unit))->unit

Register a callback on OSC messages.

osc.on_float
(string,((float)->unit))->unit

Register a callback on OSC messages.

osc.on_float_pair
(string,(((float*float))->unit))->unit

Register a callback on OSC messages.

osc.on_string
(string,((string)->unit))->unit

Register a callback on OSC messages.

osc.on_string_pair
(string,(((string*string))->unit))->unit

Register a callback on OSC messages.

osc.string
(string,string)->()->string

Read from an OSC path.

osc.string_pair
(string,(string*string))->()->(string*string)

Read from an OSC path.

print
(?newline:bool,'a)->unit

Print on standard output.

server.register
(?namespace:string,?description:string,?usage:string,
 string,((string)->string))->unit

Register a command. You can then execute this function through the server, either telnet or socket.

Liquidsoap

add_decoder
(name:string,description:string,?mimes:[string],
 test:((string)->int),string)->unit

Register an external decoder. The encoder should output in WAV format to his standard output (stdout) and read data from its standard input (stdin).

add_metadata_resolver
(string,((string)->[(string*string)]))->unit

Register an external file metadata decoder.

add_oblivious_decoder
(name:string,description:string,test:((string)->int),
 ?buffer:float,((string)->string))->unit

Register an external file decoder. The encoder should output in WAV format to his standard output (stdout) and read data from the file it receives. The estimated remaining duration for this decoder will be unknown until the buffer last seconds of the file. If possible, it is recommended to decode from stdin and use add_decoder.

add_protocol
(?temporary:bool,string,((string,float)->[string]))->unit

Register a new protocol.

clock
(?sync:bool,?id:string,source('a))->source('a)

Assign a new clock to the given source (and to other time-dependent sources) and return the source. It is a conveniency wrapper around clock.assign_new(), allowing more concise scripts in some cases.

clock.assign_new
(?id:string,?sync:bool,[source('a)])->unit

Create a new clock and assign it to a list of sources.

clock.unify
([source('a)])->unit

Enforce that a list of sources all belong to the same clock.

configure.default_font
string

Liquidsoap's default font file.

configure.libdir
string

Liquidsoap's library directory.

configure.logdir
string

Liquidsoap's logging directory.

configure.rundir
string

Liquidsoap's PID file directory.

enable_replaygain_metadata
(?extract_replaygain:string)->unit

Enable replay gain metadata resolver. This resolver will process any file decoded by liquidsoap and add a replay_gain metadata when this value could be computed. For a finer-grained replay gain processing, use the replay_gain protocol.

file.duration
(string)->float

Compute the duration in seconds of audio data contained in a file. The computation may be expensive. Returns -1. if computation failed, typically if the file was not recognized as valid audio.

file.mime
(string)->string

Get the MIME type of a file, according to libmagic.

garbage_collect
()->unit

Trigger full major garbage collection.

get
(default:'a,string)->'a
where 'a is bool, int, float, string or [string]

Get a setting's value.

get_clock_status
()->[(string*int)]

Get the current time for all allocated clocks.

harbor.http.register
(port:int,method:string,string,
 ((protocol:string,data:string,headers:[(string*string)],
   string)->string))->unit

Register a HTTP handler on the harbor. The given function receives as argument the full requested uri (e.g. “foo?var=bar”), http protocol version, possible input data and the list of HTTP headers and returns the answer sent to the client, including HTTP headers. Registered uri can be regular expressions (e.g. “.+\.php”) and can override default metadata handlers.

harbor.http.remove
(method:string,port:int,string)->unit

Remove a registered HTTP handler on the harbor.

liquidsoap.version
string

Liquidsoap version string.

log
(?label:string,?level:int,string)->unit

Log a message.

log_clocks
(?delay:float,?interval:float,string)->unit

Create a log of clock times for all the clocks initially present. The log is in a simple format which you can directly use with gnuplot.

metadata.export
([(string*string)])->[(string*string)]

Filter-out internal metadata.

playlist.parse
(string)->[([(string*string)]*string)]

Try to parse a local playlist. Return a list of (metadata,URI) items, where metadata is a list of (key,value) bindings.

replaygain_protocol
(string,'a)->[string]

Register the replaygain protocol.

request.create
(?indicators:[string],?persistent:bool,string)->
request('a)

Create a request. Creation may fail if there is no available RID, which cannot be detected currently: in that case one will obtain a request that will fail to be resolved.

request.create.raw
(?indicators:[string],?persistent:bool,string)->
request(audio=0,video=0,midi=0)

Create a raw request, i.e. for files that should not be decoded for streaming. Creation may fail if there is no available RID, which cannot be detected currently: in that case one will obtain a request that will fail to be resolved.

request.destroy
(?force:bool,request('a))->unit

Destroying a request causes any temporary associated file to be deleted, and releases its RID. Persistent requests resist to destroying, unless forced.

request.filename
(request('a))->string

Return a valid local filename if the request is ready, and the empty string otherwise.

request.metadata
(request('a))->[(string*string)]

Get the metadata associated to a request.

request.ready
(request('a))->bool

Check if a request is ready, i.e. is associated to a valid local file. Unless the initial URI was such a file, a request has to be resolved before being ready.

request.resolve
(?timeout:float,request('a))->bool

Resolve a request, i.e. attempt to get a valid local file. The operation can take some time. Return true if the resolving was successful, false otherwise (timeout or invalid URI).

server.execute
(string,?string)->[string]

Execute a liquidsoap server command.

set
(string,'a)->unit
where 'a is bool, int, float, string or [string]

Change some setting. Use liquidsoap --conf-descr and liquidsoap --conf-descr-key KEY on the command-line to get some information about available settings.

source.fallible
(source('a))->bool

Indicate if a source may fail, i.e. may not be ready to stream.

source.id
(source('a))->string

Get one source's identifier.

source.init
([source(audio=*,video=*,midi=*)])->
[source(audio=*,video=*,midi=*)]

Simultaneously initialize sources, return the sublist of sources that failed to initialized.

source.is_ready
(source('a))->bool

Indicate if a source is ready to stream, or currently streaming.

source.remaining
(source('a))->float

Estimation of remaining time in the current track.

source.seek
(source('a),float)->float

Seek forward, in seconds. Returns the amount of time effectively seeked.

source.shutdown
(source('a))->unit

Desactivate a source.

source.skip
(source('a))->unit

Skip to the next track.

List

_[_]
(string,[(string*string)])->string

l[k] returns the first v such that (k,v) is in the list l (or “” if no such v exists).

list.add
('a,['a])->['a]

Add an element at the top of a list.

list.append
(['a],['a])->['a]

Catenate two lists.

list.assoc
(string,[(string*string)])->string

Alias for the l[k] notation.

list.filter
((('a)->bool),['a])->['a]

Filter a list according to a filtering function.

list.fold
((('a,'b)->'a),'a,['b])->'a

Fold a function on every element of a list: list.fold(f,x1,[e1,..,en]) is f(...f(f(x1,e1),e2)...,en).

list.hd
([string])->string

Return the head (first element) of a list, or “” if the list is empty.

list.iter
((('a)->unit),['a])->unit

Call a function on every element of a list.

list.length
(['a])->int

Get the length of a list, i.e. its number of elements.

list.map
((('a)->'b),['a])->['b]

Map a function on every element of a list.

list.mem
('a,['a])->bool where 'a is an orderable type

Check if an element belongs to a list.

list.mem_assoc
('a,[('a*'b)])->bool where 'a is an orderable type

list.mem_assoc(key,l) returns true if l contains a pair (key,value)

list.nth
(['a],int)->'a

Get the n-th element of a list (the first element is at position 0).

list.randomize
(['a])->['a]

Shuffle the content of a list.

list.remove
('a,['a])->['a]

Remove a value from a list.

list.remove_assoc
(string,[(string*string)])->[(string*string)]

Remove a pair from an associative list

list.rev
(['a])->['a]

Revert list order.

list.sort
((('a,'a)->int),['a])->['a]

Sort a list according to a comparison function.

list.tl
(['a])->['a]

Return the list without its first element.

Math

*
('a,'a)->'a where 'a is a number type

Multiplication of numbers.

+
('a,'a)->'a where 'a is a number type

Addition of numbers.

-
('a,'a)->'a where 'a is a number type

Substraction of numbers.

/
('a,'a)->'a where 'a is a number type

Division of numbers.

abs
('a)->'a where 'a is a number type

Absolute value.

bool_of_float
(float)->bool

Convert a float to a bool.

bool_of_int
(int)->bool

Convert an int to a bool.

dB_of_lin
(float)->float

Convert linear scale into decibels.

float_of_int
(int)->float

Convert an int to a float.

int_of_float
(float)->int

Convert a float to a int.

lin_of_dB
(float)->float

Convert decibels into linear scale.

mod
(int,int)->int

Integer remainder. If y is not zero, x == (x / y) * y + x mod y, and abs(x mod y) <= abs(y)-1.

pow
('a,'a)->'a where 'a is a number type

Exponentiation of numbers.

random.float
(?min:float,?max:float)->float

Generate a random value.

random.int
(?min:float,?max:float)->int

Generate a random value.

~-
('a)->'a where 'a is a number type

Returns the opposite of its argument.

Pair

fst
(('a*'b))->'a

Get the first component of a pair.

snd
(('a*'b))->'b

Get the second component of a pair.

String

%
(string,[(string*string)])->string

pattern % [...,(k,v),...] changes in the pattern occurences of: - $(k) into v; - $(if $(k2),"a","b") into “a” if k2 is found in the list, “b” otherwise.

^
(string,string)->string

Concatenate strings.

base64.decode
(string)->string

Decode a Base64 encoded string.

base64.encode
(string)->string

Encode a string in Base64.

bool_of_string
(?default:bool,string)->bool

Convert a string to a bool.

float_of_string
(?default:float,string)->float

Convert a string to a float.

int_of_string
(?default:int,string)->int

Convert a string to a int.

json_of
(?compact:bool,'a)->string

Convert a value to a json string.

of_json
(default:'a,string)->'a

Parse a json string into a liquidsoap value.

quote
(string)->string

Escape shell metacharacters.

string.capitalize
(?capitalize:bool,?space_sensitive:bool,string)->string

Return a string with the first character set to upper case (capitalize), or to lower case (uncapitalize).

string.case
(?lower:bool,string)->string

Convert a string to lower or upper case.

string.concat
(?separator:string,[string])->string

Concatenate strings.

string.escape
(?special_chars:[string],?escape_char:((string)->string),
 string)->string

Escape special charaters in a string. String is parsed char by char. See string.utf8.escape for an UTF8-aware parsing function.

string.extract
(pattern:string,string)->[(string*string)]

Extract substrings from a string. Perl compatible regular expressions are recognized. Hence, special characters should be escaped. Returns a list of (index,value). If the list does not have a pair associated to some index, it means that the corresponding pattern was not found.

string.length
(string)->int

Get the length of a string.

string.match
(pattern:string,string)->bool

Match a string with an expression. Perl compatible regular expressions are recognized. Hence, special characters should be escaped.

string.recode
(?in_enc:string,?out_enc:string,string)->string

Convert a string. Effective only if Camomile is enabled.

string.replace
(pattern:string,((string)->string),string)->string

Replace substrings in a string. Will replace all substrings matched in the pattern by the string returned by the replace function.

string.split
(separator:string,string)->[string]

Split a string at 'separator'. Perl compatible regular expressions are recognized. Hence, special characters should be escaped.

string.utf8.escape
(?special_chars:[string],?escape_char:((string)->string),
 string)->string

Escape special charaters in an UTF8 string.

string_of
('a)->string

Return the representation of a value.

url.decode
(?plus:bool,string)->string

Decode an encoded url (e.g. “%20” becomes “ ”).

url.encode
(?plus:bool,string)->string

Encode an url (e.g. “ ” becomes “%20”).

url.split
(string)->(string*[(string*string)])

Split an url of the form foo?arg=bar&arg2=bar2 into (“foo”,[(“arg”,“bar”),(“arg2”,“bar2”)]).

System

argv
(?default:string,int)->string

Get command-line parameters.

basename
(string)->string

Get the base name of a path.

dirname
(string)->string

Get the directory name of a path.

environment
()->[(string*string)]

Return the process environment.

exec_at
(?freq:float,pred:(()->bool),(()->unit))->unit

Execute a given action when a predicate is true. This will be run in background.

file.exists
(string)->bool

Returns true if the file or directory exists.

file.mime_default
(string)->string

Alias of file.mime (because it is available)

file.watch
(string,(()->unit))->()->unit

Call a function when a file is modified. Returns unwatch function.

get_mime
(string)->string

Generic mime test. First try to use file.mime if it exist. Otherwise try to get the value using the file binary. Returns “” (empty string) if no value can be find.

get_process_lines
(string)->[string]

Perform a shell call and return the list of its output lines.

get_process_output
(string)->string

Perform a shell call and return its output.

getenv
(string)->string

Get the value associated to a variable in the process environment. Return “” if variable is not set.

getopt
(?default:string,string)->string

Parse command line options: getopt("-o") returns “1” if “-o” was passed without any parameter, “0” otherwise. getopt(default="X","-o") returns “Y” if “-o Y” was passed, “X” otherwise. The result is removed from the list of arguments, affecting subsequent calls to argv() and getopt().

getpid
()->int

Get the process' pid.

gettimeofday
()->float

Return the current time since 00:00:00 GMT, Jan. 1, 1970, in seconds.

is_directory
(string)->bool

Returns true if the directory exists.

on_shutdown
((()->unit))->unit

Register a function to be called when Liquidsoap shuts down.

os.type
string

Type of OS running liquidsoap.

path.concat
(string,string)->string

Concatenate two paths, using the appropriate directory separator.

read
(?hide:bool)->string

Read some value from standard input (console).

reopen.stderr
(string)->unit

Reopen standard error on the given file

reopen.stdin
(string)->unit

Reopen standard input on the given file

reopen.stdout
(string)->unit

Reopen standard output on the given file

setenv
(string,string)->unit

Set the value associated to a variable in the process environment.

shutdown
()->unit

Shutdown the application.

source.on_shutdown
(source('a),(()->unit))->unit

Register a function to be called when source shuts down.

system
(string)->unit

Shell command call. Set verbose to true to log process' output and errors.

test_process
(string)->bool

Return true if process exited with 0 code. Command should return quickly.

Uncategorized

playlist.merge
(?id:string,?random:bool,string)->source('a)

Play the whole playlist as one track.