Skip to main content
Version: 2.5.x (dev)

Source / Audio processing

add

Mix sources, with optional normalization. Metadata are relayed from all sources. Track marks are dropped from all sources.

Type:

(?id : string?, ?normalize : {bool}, ?power : {bool}, ?weights : [{float}],
[source('a)]) -> source('a)
where 'a is a set of internal tracks

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • normalize (of type {bool}, which defaults to true): Divide by the sum of weights of ready sources (or by the number of ready sources if weights are not specified).
  • power (of type {bool}, which defaults to false): Perform constant-power normalization.
  • weights (of type [{float}], which defaults to []): Relative weight of the sources in the sum. The empty list stands for the homogeneous distribution. These are used as amplification coefficients if we are not normalizing.
  • (unlabeled) (of type [source('a)] where 'a is a set of internal tracks)

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source('A), track_sensitive : bool}) -> unit where 'A is a set of internal tracks): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ({ending : source('A)?, replay_metadata : bool, starting : source('A)}) -> source('A) where 'A is a set of internal tracks): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

dtmf.detect

Detect DTMF tones.

Type:

(?id : string?, ?bands : int, ?debug : {bool}, ?duration : {float},
?smoothing : {float}, ?threshold : {float}, source(audio=pcm('a), 'b),
((string) -> unit)) -> source(audio=pcm('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • bands (of type int, which defaults to 1024): Number of frequency bands.
  • debug (of type {bool}, which defaults to false): Show internal values on standard output in order to fine-tune parameters: band number, band frequency, detected intensity and smoothed intensity.
  • duration (of type {float}, which defaults to 0.05): Duration for detecting a tone.
  • smoothing (of type {float}, which defaults to 0.01): Smoothing time (in seconds) for band indensity (the higher, the less sensitive we are to local variations, but the more time we take to detect a band).
  • threshold (of type {float}, which defaults to 50.0): Threshold for detecting a band.
  • (unlabeled) (of type source(audio=pcm('a), 'b)): Source on which DTMF tones should be detected.
  • (unlabeled) (of type (string) -> unit): Function called with detected key as argument.

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(audio=pcm('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(audio=pcm('B), 'A)?, replay_metadata : bool, starting : source(audio=pcm('B), 'A) }) -> source(audio=pcm('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

echo

Add echo.

Type:

(?id : string?, ?delay : {float}, ?feedback : {float}, ?ping_pong : bool,
source(audio=pcm('a), 'b)) -> source(audio=pcm('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • delay (of type {float}, which defaults to 0.5): Delay in seconds.
  • feedback (of type {float}, which defaults to -6.0): Feedback coefficient in dB (negative).
  • ping_pong (of type bool, which defaults to false): Use ping-pong delay.
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(audio=pcm('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(audio=pcm('B), 'A)?, replay_metadata : bool, starting : source(audio=pcm('B), 'A) }) -> source(audio=pcm('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

filter

Perform several kinds of filtering on the signal. Only frequencies below the sampling rate / 4 (generally 10 kHz) are handled well for the freq parameter.

Type:

(?id : string?, freq : {float}, mode : string, ?q : {float},
?wetness : {float}, source(audio=pcm('a), 'b)) -> source(audio=pcm('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • freq (of type {float}): Characteristic frequency of the filter.
  • mode (of type string): Available modes are 'low' (for low-pass filter), 'high' (for high-pass filter), 'band' (for band-pass filter) and 'notch' (for notch / band-stop / band-rejection filter).
  • q (of type {float}, which defaults to 1.0)
  • wetness (of type {float}, which defaults to 1.0): How much of the original signal should be added (1. means only filtered and 0. means only original signal).
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(audio=pcm('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(audio=pcm('B), 'A)?, replay_metadata : bool, starting : source(audio=pcm('B), 'A) }) -> source(audio=pcm('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

filter.fir

Low-pass FIR filter.

Type:

(?id : string?, beta : float, ?coeffs : int, frequency : float,
source(audio=pcm('a), 'b)) -> source(audio=pcm('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • beta (of type float): Beta should range between 0 and 1.
  • coeffs (of type int, which defaults to 255): Number of coefficients
  • frequency (of type float): Corner frequency in Hz (frequency at which the response is 0.5, that is -6 dB).
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(audio=pcm('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(audio=pcm('B), 'A)?, replay_metadata : bool, starting : source(audio=pcm('B), 'A) }) -> source(audio=pcm('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

filter.iir.butterworth.bandpass

IIR filter

Type:

(?id : string?, frequency1 : float, frequency2 : float, ?order : int,
source(audio=pcm('a), 'b)) -> source(audio=pcm('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • frequency1 (of type float): First corner frequency
  • frequency2 (of type float): Second corner frequency
  • order (of type int, which defaults to 4): Filter order
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(audio=pcm('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(audio=pcm('B), 'A)?, replay_metadata : bool, starting : source(audio=pcm('B), 'A) }) -> source(audio=pcm('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

filter.iir.butterworth.bandstop

IIR filter

Type:

(?id : string?, frequency1 : float, frequency2 : float, ?order : int,
source(audio=pcm('a), 'b)) -> source(audio=pcm('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • frequency1 (of type float): First corner frequency
  • frequency2 (of type float): Second corner frequency
  • order (of type int, which defaults to 4): Filter order
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(audio=pcm('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(audio=pcm('B), 'A)?, replay_metadata : bool, starting : source(audio=pcm('B), 'A) }) -> source(audio=pcm('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

filter.iir.butterworth.high

IIR filter

Type:

(?id : string?, frequency : float, ?order : int, source(audio=pcm('a), 'b)) ->
source(audio=pcm('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • frequency (of type float): Corner frequency
  • order (of type int, which defaults to 4): Filter order
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(audio=pcm('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(audio=pcm('B), 'A)?, replay_metadata : bool, starting : source(audio=pcm('B), 'A) }) -> source(audio=pcm('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

filter.iir.butterworth.low

IIR filter

Type:

(?id : string?, frequency : float, ?order : int, source(audio=pcm('a), 'b)) ->
source(audio=pcm('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • frequency (of type float): Corner frequency
  • order (of type int, which defaults to 4): Filter order
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(audio=pcm('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(audio=pcm('B), 'A)?, replay_metadata : bool, starting : source(audio=pcm('B), 'A) }) -> source(audio=pcm('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

filter.iir.eq.allpass

All-pass biquad filter.

Type:

(?id : string?, ?bandwidth : {float}, frequency : {float}, source('a)) ->
source('a)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • bandwidth (of type {float}, which defaults to 0.333333333333): Bandwidth (in octaves)
  • frequency (of type {float}): Center frequency
  • (unlabeled) (of type source('a))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source('A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ({ending : source('A)?, replay_metadata : bool, starting : source('A)}) -> source('A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

filter.iir.eq.bandpass

Band-pass biquad filter.

Type:

(?id : string?, frequency : {float}, ?q : {float}, source('a)) -> source('a)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • frequency (of type {float}): Center frequency
  • q (of type {float}, which defaults to 1.0): Q
  • (unlabeled) (of type source('a))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source('A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ({ending : source('A)?, replay_metadata : bool, starting : source('A)}) -> source('A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

filter.iir.eq.high

High-pass biquad filter.

Type:

(?id : string?, frequency : {float}, ?q : {float}, source('a)) -> source('a)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • frequency (of type {float}): Corner frequency
  • q (of type {float}, which defaults to 1.0): Q
  • (unlabeled) (of type source('a))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source('A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ({ending : source('A)?, replay_metadata : bool, starting : source('A)}) -> source('A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

filter.iir.eq.highshelf

High shelf biquad filter.

Type:

(?id : string?, frequency : {float}, ?slope : {float}, source('a)) ->
source('a)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • frequency (of type {float}): Center frequency
  • slope (of type {float}, which defaults to 1.0): Shelf slope (in dB/octave)
  • (unlabeled) (of type source('a))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source('A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ({ending : source('A)?, replay_metadata : bool, starting : source('A)}) -> source('A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

filter.iir.eq.low

Low-pass biquad filter.

Type:

(?id : string?, frequency : {float}, ?q : {float}, source('a)) -> source('a)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • frequency (of type {float}): Corner frequency
  • q (of type {float}, which defaults to 1.0): Q
  • (unlabeled) (of type source('a))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source('A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ({ending : source('A)?, replay_metadata : bool, starting : source('A)}) -> source('A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

filter.iir.eq.lowshelf

Low shelf biquad filter.

Type:

(?id : string?, frequency : {float}, ?slope : {float}, source('a)) ->
source('a)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • frequency (of type {float}): Corner frequency
  • slope (of type {float}, which defaults to 1.0): Shelf slope (dB/octave)
  • (unlabeled) (of type source('a))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source('A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ({ending : source('A)?, replay_metadata : bool, starting : source('A)}) -> source('A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

filter.iir.eq.notch

Band-pass biquad filter.

Type:

(?id : string?, frequency : {float}, ?q : {float}, source('a)) -> source('a)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • frequency (of type {float}): Center frequency
  • q (of type {float}, which defaults to 1.0): Q
  • (unlabeled) (of type source('a))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source('A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ({ending : source('A)?, replay_metadata : bool, starting : source('A)}) -> source('A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

filter.iir.eq.peak

Peak EQ biquad filter.

Type:

(?id : string?, frequency : {float}, ?gain : {float}, ?q : {float},
source('a)) -> source('a)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • frequency (of type {float}): Center frequency
  • gain (of type {float}, which defaults to 1.0): Gain (in dB)
  • q (of type {float}, which defaults to 1.0): Q
  • (unlabeled) (of type source('a))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source('A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ({ending : source('A)?, replay_metadata : bool, starting : source('A)}) -> source('A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

filter.iir.resonator.allpass

IIR filter

Type:

(?id : string?, frequency : float, ?q : float, source(audio=pcm('a), 'b)) ->
source(audio=pcm('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • frequency (of type float): Corner frequency
  • q (of type float, which defaults to 60.0): Quality factor
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(audio=pcm('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(audio=pcm('B), 'A)?, replay_metadata : bool, starting : source(audio=pcm('B), 'A) }) -> source(audio=pcm('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

filter.iir.resonator.bandpass

IIR filter

Type:

(?id : string?, frequency : float, ?q : float, source(audio=pcm('a), 'b)) ->
source(audio=pcm('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • frequency (of type float): Corner frequency
  • q (of type float, which defaults to 60.0): Quality factor
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(audio=pcm('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(audio=pcm('B), 'A)?, replay_metadata : bool, starting : source(audio=pcm('B), 'A) }) -> source(audio=pcm('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

filter.iir.resonator.bandstop

IIR filter

Type:

(?id : string?, frequency : float, ?q : float, source(audio=pcm('a), 'b)) ->
source(audio=pcm('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • frequency (of type float): Corner frequency
  • q (of type float, which defaults to 60.0): Quality factor
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(audio=pcm('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(audio=pcm('B), 'A)?, replay_metadata : bool, starting : source(audio=pcm('B), 'A) }) -> source(audio=pcm('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

filter.rc

First-order filter (RC filter).

Type:

(?id : string?, frequency : {float}, mode : string, ?wetness : {float},
source(audio=pcm('a), 'b)) -> source(audio=pcm('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • frequency (of type {float}): Cutoff frequency.
  • mode (of type string): Available modes are 'low' (for low-pass filter), 'high' (for high-pass filter).
  • wetness (of type {float}, which defaults to 1.0): How much of the original signal should be added (1. means only filtered and 0. means only original signal).
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(audio=pcm('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(audio=pcm('B), 'A)?, replay_metadata : bool, starting : source(audio=pcm('B), 'A) }) -> source(audio=pcm('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

flanger

Flanger effect.

Type:

(?id : string?, ?delay : float, ?feedback : {float}, ?freq : {float},
?phase : {float}, source(audio=pcm('a), 'b)) -> source(audio=pcm('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • delay (of type float, which defaults to 0.001): Delay in seconds.
  • feedback (of type {float}, which defaults to 0.0): Feedback coefficient in dB.
  • freq (of type {float}, which defaults to 0.5): Frequency in Hz.
  • phase (of type {float}, which defaults to 1.0): Phase difference between channels in radians.
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(audio=pcm('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(audio=pcm('B), 'A)?, replay_metadata : bool, starting : source(audio=pcm('B), 'A) }) -> source(audio=pcm('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

gate

Reduce the volume when the stream is silent (typically in order to avoid low intensity noise).

Type:

(?id : string?, ?attack : {float}, ?hold : {float}, ?range : {float},
?release : {float}, ?threshold : {float}, ?window : {float},
source(audio=pcm('a), 'b)) -> source(audio=pcm('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • attack (of type {float}, which defaults to 10.0): Time to fully open the gate (ms).
  • hold (of type {float}, which defaults to 1000.0): Minimum amount of time the gate stays open (ms).
  • range (of type {float}, which defaults to -30.0): Difference between closed and open level (dB).
  • release (of type {float}, which defaults to 2000.0): Time to fully close the gate (ms).
  • threshold (of type {float}, which defaults to -30.0): Threshold at which the gate will open (dB).
  • window (of type {float}, which defaults to 1.0): Duration for computing peak (ms).
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • gate (of type () -> float): Position of the gate (0. means closed, 1. means open).
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(audio=pcm('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(audio=pcm('B), 'A)?, replay_metadata : bool, starting : source(audio=pcm('B), 'A) }) -> source(audio=pcm('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

normalize.old

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. This is the implementation provided in Liquidsoap < 2.0. A new, better and more customizable one is now given in normalize.

Type:

(?id : string?, ?gain_max : {float}, ?gain_min : {float}, ?k_down : {float},
?k_up : {float}, ?target : {float}, ?threshold : {float},
?track_sensitive : bool, ?window : float, source(audio=pcm('a), 'b)) ->
source(audio=pcm('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • gain_max (of type {float}, which defaults to 6.0): Maximal gain value (dB).
  • gain_min (of type {float}, which defaults to -6.0): Minimal gain value (dB).
  • k_down (of type {float}, which defaults to 0.1): Coefficient when the power must go down (between 0 and 1, slowest to fastest).
  • k_up (of type {float}, which defaults to 0.005): Coefficient when the power must go up (between 0 and 1, slowest to fastest).
  • target (of type {float}, which defaults to -13.0): Desired RMS (dB).
  • threshold (of type {float}, which defaults to -40.0): Minimal RMS for activaing gain control (dB).
  • track_sensitive (of type bool, which defaults to true): Reset values on every track.
  • window (of type float, which defaults to 0.1): Duration of the window used to compute the current RMS power (second).
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • gain (of type () -> float): Current amplification coefficient.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • rms (of type () -> float): Current RMS.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(audio=pcm('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(audio=pcm('B), 'A)?, replay_metadata : bool, starting : source(audio=pcm('B), 'A) }) -> source(audio=pcm('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

peak

Get current peak volume of the source. Returns the source with a method peak to compute the current peak volume of the source, with 0.0 <= peak volume <= 1.0.

Type:

(?id : string?, ?duration : {float}, source(audio=pcm('a), 'b)) ->
source(audio=pcm('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • duration (of type {float}, which defaults to 0.5): Duration of the window (in seconds). A value <= 0, means that computation should not be performed.
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • peak (of type () -> float): Current value for the peak volume.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(audio=pcm('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(audio=pcm('B), 'A)?, replay_metadata : bool, starting : source(audio=pcm('B), 'A) }) -> source(audio=pcm('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

peak.stereo

Get current peak volume of the source. Returns the source with a method peak to compute the current peak volume of the source, with 0.0 <= peak volume <= 1.0.

Type:

(?id : string?, ?duration : {float}, source(audio=pcm(stereo), 'a)) ->
source(audio=pcm(stereo), 'a)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • duration (of type {float}, which defaults to 0.5): Duration of the window (in seconds). A value <= 0, means that computation should not be performed.
  • (unlabeled) (of type source(audio=pcm(stereo), 'a))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • peak (of type () -> float * float): Current value for the peak volume.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(audio=pcm(stereo), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(audio=pcm(stereo), 'A)?, replay_metadata : bool, starting : source(audio=pcm(stereo), 'A) }) -> source(audio=pcm(stereo), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

pipe

Process audio signal through a given process stdin/stdout.

Type:

(?id : string?, ?buffer : float, ?data_length : int?, ?max : float,
process : string, ?replay_delay : float?, ?restart : bool,
?restart_on_error : bool, source(audio=pcm('a), 'b)) ->
source(audio=pcm('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • buffer (of type float, which defaults to 1.0): Duration of the pre-buffered data.
  • data_length (of type int?, which defaults to null): Length passed in the WAV data chunk. Data is streamed so no the consuming program should process it as it comes. Some program operate better when this value is set to 0, some other when it is set to the maximum length allowed by the WAV specs. Use any negative value to set to maximum length.
  • max (of type float, which defaults to 10.0): Maximum duration of the buffered data.
  • process (of type string): Process used to pipe data to.
  • replay_delay (of type float?, which defaults to null): Replay track marks and metadata from the input source on the output after a given delay. If null (default) close and flush the process on each track and metadata to get an exact timing. This parameter is typically used when integrating with stereotool.
  • restart (of type bool, which defaults to true): Restart process when exited.
  • restart_on_error (of type bool, which defaults to true): Restart process when exited with error.
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(audio=pcm('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(audio=pcm('B), 'A)?, replay_metadata : bool, starting : source(audio=pcm('B), 'A) }) -> source(audio=pcm('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

rms

Get current RMS volume of the source. Returns the source with a method rms to compute the current RMS volume of the source, with 0.0 <= RMS volume <= 1.0.

Type:

(?id : string?, ?duration : {float}, source(audio=pcm('a), 'b)) ->
source(audio=pcm('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • duration (of type {float}, which defaults to 0.5): Duration of the window (in seconds). A value <= 0, means that computation should not be performed.
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • rms (of type () -> float): Current value for the RMS volume.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(audio=pcm('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(audio=pcm('B), 'A)?, replay_metadata : bool, starting : source(audio=pcm('B), 'A) }) -> source(audio=pcm('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

rms.stereo

Get current RMS volume of the source. Returns the source with a method rms to compute the current RMS volume of the source, with 0.0 <= RMS volume <= 1.0.

Type:

(?id : string?, ?duration : {float}, source(audio=pcm(stereo), 'a)) ->
source(audio=pcm(stereo), 'a)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • duration (of type {float}, which defaults to 0.5): Duration of the window (in seconds). A value <= 0, means that computation should not be performed.
  • (unlabeled) (of type source(audio=pcm(stereo), 'a))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • rms (of type () -> float * float): Current value for the RMS volume.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(audio=pcm(stereo), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(audio=pcm(stereo), 'A)?, replay_metadata : bool, starting : source(audio=pcm(stereo), 'A) }) -> source(audio=pcm(stereo), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

sine.detect

Detect sine waves.

Type:

(?id : string?, ?bands : int, ?debug : {bool}, ?duration : {float},
?smoothing : {float}, ?threshold : {float}, [float], source(audio=pcm('a),
'b), ((float) -> unit)) -> source(audio=pcm('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • bands (of type int, which defaults to 1024): Number of frequency bands.
  • debug (of type {bool}, which defaults to false): Show internal values on standard output in order to fine-tune parameters: band number, band frequency, detected intensity and smoothed intensity.
  • duration (of type {float}, which defaults to 0.5): Duration for detecting a tone.
  • smoothing (of type {float}, which defaults to 0.01): Smoothing time (in seconds) for band indensity (the higher, the less sensitive we are to local variations, but the more time we take to detect a band).
  • threshold (of type {float}, which defaults to 50.0): Threshold for detecting a band.
  • (unlabeled) (of type [float]): List of frequencies to detect.
  • (unlabeled) (of type source(audio=pcm('a), 'b)): Source on which sines should be detected.
  • (unlabeled) (of type (float) -> unit): Function called with detected frequency as argument.

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(audio=pcm('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(audio=pcm('B), 'A)?, replay_metadata : bool, starting : source(audio=pcm('B), 'A) }) -> source(audio=pcm('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

soundtouch

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

Type:

(?id : string?, ?pitch : {float}, ?rate : {float}, ?tempo : {float},
source(audio=pcm('a), 'b)) -> source(audio=pcm('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • pitch (of type {float}, which defaults to 1.0)
  • rate (of type {float}, which defaults to 1.0)
  • tempo (of type {float}, which defaults to 1.0)
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(audio=pcm('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(audio=pcm('B), 'A)?, replay_metadata : bool, starting : source(audio=pcm('B), 'A) }) -> source(audio=pcm('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).

This function is experimental.

source.replaygain.compute

Compute the ReplayGain of the source. Data is accumulated until the gain method is called, i.e. the gain is computed after the source has been played..

Type:

(?id : string?, source(audio=pcm('a), 'b)) -> source(audio=pcm('a), 'b)

Composition:

This source inherits composition from its effective source.

Arguments:

  • id (of type string?, which defaults to null): Force the value of the source ID.
  • (unlabeled) (of type source(audio=pcm('a), 'b))

Methods:

  • buffered (of type () -> [string * float]): Length of buffered data.
  • clear_last_metadata (of type () -> unit): Clear the last metadata from the source.
  • clock (of type clock): The source's clock
  • duration (of type () -> float): Estimation of the duration of the current track.
  • elapsed (of type () -> float): Elapsed time in the current track.
  • fallible (of type bool): Indicate if a source may fail, i.e. may not be ready to stream.
  • gain (of type () -> float): Suggested gain (in dB).
  • generate_frame (of type () -> unit): Generate a frame from the source without consuming it. This can be useful in advanced cases where generating a frame is required to trigger some side effect like calculating some metadata before making a decision. You should make sure that the source is available before calling this function and it should only be called inside synchronous streaming loop callback such as on_frame!
  • id (of type () -> string): Identifier of the source.
  • insert_metadata (of type (?override : bool, ?new_track : bool, [string * string]) -> unit): Dynamically insert metadata in a stream. Inserts a new track with the given metadata if new_track is true. When override is false, metadata that the source provides itself takes precedence over the inserted one.
  • is_active (of type () -> bool): true if the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically, true for outputs and sources such as input.http.
  • is_ready (of type () -> bool): Indicate if a source is ready to stream. This does not mean that the source is currently streaming, just that its resources are all properly initialized.
  • is_up (of type () -> bool): Indicate that the source can be asked to produce some data at any time. This is true when the source is currently being used or if it could be used at any time, typically inside a switch or fallback.
  • last_metadata (of type () -> [string * string]?): Return the last metadata from the source.
  • log (of type {level : (() -> int).{set : (int) -> unit}}): Get or set the source's log level, from 1 to 5.
  • peak (of type () -> float): Peak sample.
  • register_command (of type (?usage : string?, description : string, string, ((string) -> string)) -> unit): Register a server command for this source. Command is registered under the source's id namespace when it gets up and de-registered when it gets down.
  • remaining (of type () -> float): Estimation of remaining time in the current track.
  • reset (of type () -> unit): Reset ReplayGain computation.
  • reset_last_metadata_on_track (of type (() -> bool).{set : (bool) -> unit}): If true, the source's last_metadata is reset on each new track. If a metadata is present along with the track mark, then it becomes the new last_metadata, otherwise, last_metadata becomes null`.
  • seek (of type (float) -> float): Seek forward, in seconds (returns the amount of time effectively seeked).
  • self_sync (of type () -> bool): Is the source currently controlling its own real-time loop.
  • self_sync_description (of type () -> string)
  • skip (of type () -> unit): Skip to the next track.
  • time (of type () -> float): Get a source's time, based on its assigned clock.

Callbacks:

  • on_collect (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source is collected
  • on_frame (of type (?before : bool, synchronous : bool, (() -> unit)) -> unit): Call a given handler on frame. When before is true, callback is executed before computing the frame and after otherwise
  • on_frame_checksum (of type (?before : ((string?) -> unit)?, synchronous : bool, ((cache : string?, string) -> unit)) -> unit): Call a given handler Register callbacks to compute frame checksums for debugging purposes. This is useful to track frame content changes through the streaming pipeline. The before callback is called before computing the frame with the checksum of the cached frame (if any, null otherwise). The main callback is called after computing the frame with the checksum of the generated frame and the remaining cache (if any).
  • on_metadata (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler to execute on each metadata
  • on_position (of type (position : {float}, ?remaining : bool, ?allow_partial : bool, synchronous : bool, ((float, [string * string]) -> unit)) -> unit): Call a given handler on track position. If remaining is false, callback is executed when position in track is more or equal to position. If remaining is true, callback is executed when remaining time in the current track is less or equal to position. Keep in mind that elapsed time is exact while remaining time is always estimated. Remaining time is usually more accurate for file-based sources. When allow_partial is true, if the current track ends before the offset position is reached, callback is still executed
  • on_shutdown (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called when source shuts down
  • on_track (of type (synchronous : bool, (([string * string]) -> unit)) -> unit): Call a given handler on track marks
  • on_wake_up (of type (synchronous : bool, (() -> unit)) -> unit): Call a given handler to be called after the source is asked to get ready

Composition methods:

  • composition_type (of type (() -> string).{set : (string) -> unit}): This source inherits composition from its effective source.
  • on_leave (of type ({source : source(audio=pcm('B), 'A), track_sensitive : bool}) -> unit): Called after switching away from this source in a switch operator, once the transition using the ending source has completed. Receives a record with source (the source being left) and track_sensitive (true if the ending source's last frame had a track mark, i.e. it finished naturally; false if it was preempted mid-track). This function must return quickly as it runs in the streaming thread. The default depends on the active composition profile: file sources (source.composition.file) skip the source when preempted mid-track so it starts fresh on its next selection, and do nothing when it finished naturally; live sources (source.composition.live) do nothing.
  • on_select (of type ( { ending : source(audio=pcm('B), 'A)?, replay_metadata : bool, starting : source(audio=pcm('B), 'A) }) -> source(audio=pcm('B), 'A)): Called when selecting this source in a switch operator. Receives a record with starting (the incoming source) and ending (the previous source, or null when the ending source reached a track boundary). Returns the source to use. By default, both file and live profiles fade out ending when non-null (up to 1 second). The default is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • replay_metadata (of type {bool}): Whether to replay the latest metadata on this source when it is selected in a switch operator. Defaults to true. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).
  • single (of type bool): Forbid the selection of this source for two consecutive tracks in switch operators. Defaults to false.
  • track_sensitive (of type {bool}): Whether this source insists on track boundaries in switch operators: when true, it prefers not to be interrupted mid-track and not to be started mid-track. A switch may only cut into a track that is still playing when at least one of the two sources involved has track_sensitive set to false; otherwise it waits for the playing source to reach a track boundary. File-based sources default to true; live network and hardware inputs default to false. The value is looked up at runtime from the active composition profile (source.composition.file or source.composition.live depending on composition_type).