Interaction
add_skip_command
Add a skip telnet command to a source when it does not have one by default.
Type:
(source('c).{on_wake_up : ((() -> unit)) -> 'b, skip : () -> 'a}) -> 'b
Arguments:
(unlabeled)(of typesource('c).{on_wake_up : ((() -> unit)) -> 'b, skip : () -> 'a}): The source to attach the command to.
audioscrobbler.submit
Submit songs using audioscrobbler, respecting the full protocol: First signal song as now playing when starting, and then submit song when it ends.
Type:
(username : string, password : string, ?api_key : string?,
?api_secret : string?, ?delay : float, ?force : bool,
?metadata_preprocessor : (([string * string]) -> [string * string]),
source('a)) -> source('a)
Arguments:
username(of typestring)password(of typestring)api_key(of typestring?, which defaults tonull)api_secret(of typestring?, which defaults tonull)delay(of typefloat, which defaults to10.0): Submit song when there is only this delay left, in seconds.force(of typebool, which defaults tofalse): If remaining time is null, the song will be assumed to be skipped or cut, and not submitted. Set this totrueto prevent this behaviormetadata_preprocessor(of type([string * string]) -> [string * string], which defaults to<fun>): Metadata pre-processor callback. Can be used to change metadata on-the-fly before sending to nowPlaying/scrobble. If returning an empty metadata, nothing is sent at all.(unlabeled)(of typesource('a))
Methods:
buffered(of type() -> [string * float]): Length of buffered data.clock(of typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): Indicate if a source may fail, i.e. may not be ready to stream.id(of type() -> string): Identifier of the source.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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.skip(of type() -> unit): Skip to the next track.time(of type() -> float): Get a source's time, based on its assigned clock.
compress.multiband.interactive
Create a multiband compressor whose parameters are interactive variables.
Type:
(?id : string?, ?bands : int, source(audio=pcm('a), 'b)) ->
source(audio=pcm('a).{gain? : never, rms? : never}, 'b)
where
'b is a set of tracks to be muxed into a source and a set of internal tracks
Arguments:
id(of typestring?, which defaults tonull): Id of the source. Variable names are prefixed with this.bands(of typeint, which defaults to5): Number of bands.(unlabeled)(of typesource(audio=pcm('a), 'b) where 'b is a set of tracks to be muxed into a source and a set of internal tracks): Source to compress.
Methods:
buffered(of type() -> [string * float]): Length of buffered data.clock(of typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): Indicate if a source may fail, i.e. may not be ready to stream.gain(of type() -> float):id(of type() -> string): Identifier of the source.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.rms(of type() -> float):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.skip(of type() -> unit): Skip to the next track.time(of type() -> float): Get a source's time, based on its assigned clock.
interactive.bool
Read a boolean from an interactive input.
Type:
(?description : string, ?osc : string, string, bool) -> () -> bool
Arguments:
description(of typestring, which defaults to""): Description of the variable.osc(of typestring, which defaults to""): OSC address.(unlabeled)(of typestring): Name of the variable.(unlabeled)(of typebool): Initial value.
Methods:
remove(of type() -> unit):set(of type(bool) -> unit):
interactive.float
Read a float from an interactive input.
Type:
(?min : float, ?max : float, ?step : float, ?description : string,
?unit : string, ?osc : string, string, float) -> () -> float
Arguments:
min(of typefloat, which defaults to-inf): Minimal value.max(of typefloat, which defaults toinf): Maximal value.step(of typefloat, which defaults to0.1): Typical variation of the value.description(of typestring, which defaults to""): Description of the variable.unit(of typestring, which defaults to""): Unit for the variable.osc(of typestring, which defaults to""): OSC address.(unlabeled)(of typestring): Name of the variable.(unlabeled)(of typefloat): Initial value.
Methods:
remove(of type() -> unit):set(of type(float) -> unit):
interactive.harbor
Expose interactive variables through harbor http server. Once this is called, with default parameters, you can browse http://localhost:8000/interactive to change the value of interactive variables using sliders.
Type:
(?transport : http_transport
.{default_port : int, name : string, protocol : string}, ?port : int,
?uri : string) -> unit
Arguments:
transport(of typehttp_transport.{default_port : int, name : string, protocol : string}, which defaults to<unix_transport>.{default_port=80, protocol="http", name="unix"}): Http transport. Usehttp.transport.sslor http.transport.secure_transport`, when available, to enable HTTPS outputport(of typeint, which defaults to8000): Port of the server.uri(of typestring, which defaults to"/interactive"): URI of the server.
interactive.int
Read an integer from an interactive input.
Type:
(?description : string, ?osc : string, string, int) -> () -> int
Arguments:
description(of typestring, which defaults to""): Description of the variable.osc(of typestring, which defaults to""): OSC address.(unlabeled)(of typestring): Name of the variable.(unlabeled)(of typeint): Initial value.
Methods:
remove(of type() -> unit):set(of type(int) -> unit):
interactive.load
Load the value of interactive variables from a file.
Type:
(string) -> unit
Arguments:
(unlabeled)(of typestring): Name of the file.
interactive.persistent
Make the value of interactive variables persistent: they are loaded from the given file and stored there whenever updated. This function should be called after all interactive variables have been defined (variables not declared yet will not be loaded).
Type:
(string) -> unit
Arguments:
(unlabeled)(of typestring): Name of the file.
interactive.save
Save the value of all interactive variables in a file.
Type:
(string) -> unit
Arguments:
(unlabeled)(of typestring): Name of the file.
interactive.string
Read a string from an interactive input.
Type:
(?description : string, ?osc : string, string, string) -> () -> string
Arguments:
description(of typestring, which defaults to""): Description of the variable.osc(of typestring, which defaults to""): OSC address.(unlabeled)(of typestring): Name of the variable.(unlabeled)(of typestring): Initial value.
Methods:
remove(of type() -> unit):set(of type(string) -> unit):
interactive.unit
Register a callback when a unit interactive input is set.
Type:
(?description : string, ?osc : string, string, (() -> unit)) -> unit
Arguments:
description(of typestring, which defaults to""): Description of the variable.osc(of typestring, which defaults to""): OSC address.(unlabeled)(of typestring): Name of the variable.(unlabeled)(of type() -> unit): Function triggered when the value is set.
Methods:
remove(of type() -> unit):set(of type() -> unit):
spinitron.submit
Submit a track to the spinitron track system and return the parsed response
Type:
(?host : string, api_key : string, ?live : bool, ?start : string?,
?duration : int?, artist : string, ?release : string?, ?label : string?,
?genre : string?, song : string, ?composer : string?, ?isrc : string?) ->
unit
Arguments:
host(of typestring, which defaults to"https://spinitron.com/api")api_key(of typestring): API keylive(of typebool, which defaults tofalse)start(of typestring?, which defaults tonull)duration(of typeint?, which defaults tonull)artist(of typestring)release(of typestring?, which defaults tonull)label(of typestring?, which defaults tonull)genre(of typestring?, which defaults tonull)song(of typestring)composer(of typestring?, which defaults tonull)isrc(of typestring?, which defaults tonull)
Methods:
artist(of typestring):artist_custom(of typestring?):catalog_number(of typestring?):classical(of typebool?):composer(of typestring?):conductor(of typestring?):duration(of typeint?):ensemble(of typestring?):genre(of typestring?):id(of typeint):image(of typestring?):isrc(of typestring?):iswc(of typestring?):label(of typestring?):label_custom(of typestring?):links(of type{playlist : {href : string}?, self : {href : string}?}?):local(of typebool?):medium(of typestring?):new(of typebool?):note(of typestring?):performers(of typestring?):playlist_id(of typeint):release(of typestring?):release_custom(of typestring?):released(of typeint?):request(of typebool?):song(of typestring):spin_end(of typestring?):spin_start(of typestring):timezone(of typestring?):upc(of typestring?):va(of typebool?):work(of typestring?):
spinitron.submit.metadata
Submit a spin using the given metadata to the spinitron track system and return the parsed response. artist and song (or title) must be present either as metadata or as optional argument.
Type:
(?host : string, api_key : string, ?live : bool, ?start : string?,
?duration : int?, ?release : string?, ?label : string?, ?genre : string?,
?composer : string?, ?isrc : string?,
?mapper : (([string * string]) -> [string * string]), ?artist : string?,
?song : string?, [string * string]) -> unit
Arguments:
host(of typestring, which defaults to"https://spinitron.com/api")api_key(of typestring): API keylive(of typebool, which defaults tofalse)start(of typestring?, which defaults tonull)duration(of typeint?, which defaults tonull)release(of typestring?, which defaults tonull)label(of typestring?, which defaults tonull)genre(of typestring?, which defaults tonull)composer(of typestring?, which defaults tonull)isrc(of typestring?, which defaults tonull)mapper(of type([string * string]) -> [string * string], which defaults to<fun>): Metadata mapper that can be used to map metadata fields to spinitron's expected. Returned metadata are added to the submitted metadata. By default,titleis mapped tosongandalbumtoreleaseif neither of those passed otherwise.artist(of typestring?, which defaults tonull)song(of typestring?, which defaults tonull)(unlabeled)(of type[string * string]): Metadata to submit. Overrides optional arguments when present.
Methods:
artist(of typestring):artist_custom(of typestring?):catalog_number(of typestring?):classical(of typebool?):composer(of typestring?):conductor(of typestring?):duration(of typeint?):ensemble(of typestring?):genre(of typestring?):id(of typeint):image(of typestring?):isrc(of typestring?):iswc(of typestring?):label(of typestring?):label_custom(of typestring?):links(of type{playlist : {href : string}?, self : {href : string}?}?):local(of typebool?):medium(of typestring?):new(of typebool?):note(of typestring?):performers(of typestring?):playlist_id(of typeint):release(of typestring?):release_custom(of typestring?):released(of typeint?):request(of typebool?):song(of typestring):spin_end(of typestring?):spin_start(of typestring):timezone(of typestring?):upc(of typestring?):va(of typebool?):work(of typestring?):
spinitron.submit.on_metadata
Specialized version of source.on_metadata that submits spins using the source's metadata to the spinitron track system. artist and song (or title) must be present either as metadata or as optional argument.
Type:
(?id : string?, ?host : string, api_key : string, ?live : bool,
?start : string?, ?duration : int?, ?release : string?, ?label : string?,
?genre : string?, ?composer : string?, ?isrc : string?,
?mapper : (([string * string]) -> [string * string]), ?artist : string?,
?song : string?, source('a)) -> source('a)
Arguments:
id(of typestring?, which defaults tonull)host(of typestring, which defaults to"https://spinitron.com/api")api_key(of typestring): API keylive(of typebool, which defaults tofalse)start(of typestring?, which defaults tonull)duration(of typeint?, which defaults tonull)release(of typestring?, which defaults tonull)label(of typestring?, which defaults tonull)genre(of typestring?, which defaults tonull)composer(of typestring?, which defaults tonull)isrc(of typestring?, which defaults tonull)mapper(of type([string * string]) -> [string * string], which defaults to<fun>)artist(of typestring?, which defaults tonull)song(of typestring?, which defaults tonull)(unlabeled)(of typesource('a)): Metadata to submit. Overrides optional arguments when present.
Methods:
buffered(of type() -> [string * float]): Length of buffered data.clock(of typeclock): The source's clockduration(of type() -> float): Estimation of the duration of the current track.elapsed(of type() -> float): Elapsed time in the current track.fallible(of typebool): Indicate if a source may fail, i.e. may not be ready to stream.id(of type() -> string): Identifier of the source.is_active(of type() -> bool):trueif the source is active, i.e. it is continuously animated by its own clock whenever it is ready. Typically,truefor outputs and sources such asinput.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 istruewhen the source is currently being used or if it could be used at any time, typically inside aswitchorfallback.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, from1to5.on_metadata(of type((([string * string]) -> unit)) -> unit): Call a given handler on metadata packets.on_shutdown(of type((() -> unit)) -> unit): Register a function to be called when source shuts down.on_track(of type((([string * string]) -> unit)) -> unit): Call a given handler on new tracks.on_wake_up(of type((() -> unit)) -> unit): Register a function to be called after the source is asked to get ready. This is when, for instance, the source's final ID is set.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}): Iftrue, the source'slast_metadatais reset on each new track. If a metadata is present along with the track mark, then it becomes the newlast_metadata, otherwise,last_metadata becomesnull`.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.skip(of type() -> unit): Skip to the next track.time(of type() -> float): Get a source's time, based on its assigned clock.
spinitron.submit.raw
Submit a track to the spinitron track system and return the raw response.
Type:
(?host : string, api_key : string, ?live : bool, ?start : string?,
?duration : int?, artist : string, ?release : string?, ?label : string?,
?genre : string?, song : string, ?composer : string?, ?isrc : string?) ->
string
Arguments:
host(of typestring, which defaults to"https://spinitron.com/api")api_key(of typestring): API keylive(of typebool, which defaults tofalse)start(of typestring?, which defaults tonull)duration(of typeint?, which defaults tonull)artist(of typestring)release(of typestring?, which defaults tonull)label(of typestring?, which defaults tonull)genre(of typestring?, which defaults tonull)song(of typestring)composer(of typestring?, which defaults tonull)isrc(of typestring?, which defaults tonull)
Methods:
headers(of type[string * string]): HTTP headers.http_version(of typestring): Version of the HTTP protocol.status_code(of typeint): Status code.status_message(of typestring): Status message.