SynchronizedAudioPlayer Node
Plays a loaded audio file in sync with a Timeline node. The input bus takes a Timeline output, whose left channel carries the timeline position in frames, and the output bus carries the audio at that position, shifted by offset. Input and output must have the same format.
Configuration
This object does not provide any configuration options.
Properties
Inherits properties from its parents, Node, SwitchboardObject.
duration (Read only)
Type: Float
Unit: ms
Length in milliseconds of the loaded audio, minus startOffset and endOffset. 0 when no audio is loaded.
endOffset
Type: Float
Default: 0.0
Seconds cut from the end of the loaded audio when repeat is enabled, so the loop wraps earlier. Without repeat the audio still plays to its end. Can only be set once audio is loaded, and is reset to 0 by load.
offset
Type: Float
Default: 0.0
Timeline position in seconds at which the start of the audio plays. Negative values start playback partway into the audio. Stored as a frame count using the sample rate at the time it is set.
repeat
Type: Boolean
Default: false
When true, the audio between startOffset and endOffset loops for as long as the timeline runs. Can only be set once audio is loaded, and is reset to false by load.
startOffset
Type: Float
Default: 0.0
Seconds skipped at the start of the loaded audio. Can only be set once audio is loaded, and is reset to 0 by load.
Actions
Inherits actions from its parent, SwitchboardObject.
load
Decodes an audio file into memory, replacing the current audio and resetting startOffset, endOffset and repeat. The audio is converted to the graph's sample rate when the graph starts, so load it before starting the graph.
Parameters
| Name | Type | Description |
|---|---|---|
audioFilePath | String | The path of the audio file to load. |
codec | String | The format of the file: wav, mp3, ogg, or apple to use the system decoder on Apple platforms. It is not detected from the file extension. |
Return Value
Boolean — true on success. Fails if the file cannot be read or decoded.
Events
This object does not provide any events.