Audio file input

Audio File input properties for Script Engine. Plays back an audio file as an audio source in the project. Supported formats: WAV, MP3, FLAC, OGG, and OPUS. Supports play / pause / stop, optional looping, optional auto-play on load, and a callback hook that lets a script react when the file reaches the end.

Property Type Access Description
ShowAdvancedOptions bool get/set Show or hide the input's advanced settings in the editor UI. [default=false].
SourceUrl Uri get/set Path or URL to the audio file to play. Accepts a local file path or a remote URL pointing at a supported audio format (WAV, MP3, FLAC, OGG, OPUS). Clearing this stops playback. While playback is running, this property is locked — stop the input before changing the source.
MediaPlayerState MediaPlayerState get Current playback state of the input (read-only). Reflects whether the file is NoMedia (nothing loaded), Parsing (opening), Playing, Paused, Stopped, or in an error state. Driven indirectly by PlayCommand, PauseCommand, StopCommand, and by AutoPlay at load time.
CurrentTime TimeCode get Current playback position in the audio file, as a time code (read-only). Updates continuously while the file is playing. Useful from a script to display the playhead, drive other components, or detect when a particular moment in the audio has been reached.
PlayCommand Command get Start playing the loaded audio file.
PauseCommand Command get Pause playback at the current position.
StopCommand Command get Stop playback and rewind to the beginning.
LoopPlayback bool get/set Whether the file restarts from the beginning when it reaches the end. [default=false]. When true, the file plays in a continuous loop. When false, playback stops at the end and the end-of-file callback (if set) is invoked.
AutoPlay bool get/set Whether the file starts playing as soon as the project loads. [default=true]. When true, playback begins automatically once the source is ready. Disable to require an explicit PlayCommand, useful when audio should only start on operator action or via a script trigger.
DisposeLibAvParser bool get/set Whether to free file resources when playback stops. [default=true]. When true, the file is fully released on stop, freeing memory at the cost of a small reload delay the next time playback starts. Disable to keep the file ready for an instant restart, at the cost of holding its memory while idle.
PlayBackEndOfFileCallback string get/set Name of a script function to call when the file reaches the end. Lets you react to end-of-file from a Script Engine script — for example to chain into the next clip, fire a transition, or log the event. Leave blank to skip the callback. Has no effect when LoopPlayback is true (the file never reaches a true end-of-file).
Minilog FormattedMessage get Most recent status, info, or error message from the input (read-only). The input writes here when the source loads, when playback starts/stops, when the file reaches the end, or when something goes wrong. Read this from a script to surface the latest event.
AudioBufferLengthMs double get How much audio is currently buffered ahead of the playhead, in milliseconds (read-only, debug). A small buffer is normal during steady playback. A persistently low or zero value while playing suggests the source can't keep up (slow disk, slow network) and may produce audible drop-outs.
LoopsPlayed int get How many times the file has looped since playback started (read-only). Only increments when LoopPlayback is true and the file wraps from end back to start. Useful from a script to limit the number of loops or to schedule events on every Nth repeat.
LibAvInitTimeMs string get Time it took to open the audio file the first time, in milliseconds (read-only, debug).
LibAvStopTimeMs string get Time it took to release the audio file on the most recent stop, in milliseconds (read-only, debug).
ParserIterations int get Number of read iterations performed during the most recent playback loop (read-only, debug). Internal diagnostic counter. Useful when troubleshooting performance issues with very short or very large audio files.
AudioTrackInfo Dictionary<string, object> get Metadata about the loaded audio track (read-only). Contains technical details exposed by the file — codec, sample rate, channel count, bit rate, duration, and so on. Available from a script as a dictionary of key/value pairs once the file has finished loading.

Inherits from: AbstractInput, AbstractAudioProcessing, AbstractAudioMetering.

See also: Audio file input in Inputs — user-facing introduction, screenshots, and section summaries.