Creates an instance of the Playback class.
Protected Optional_Optional_Optional_Optional_Per-playback send-gain allocations owned by the shared routing state machine. Cleanup disconnects every allocation deterministically.
Protected_OptionalgainOptionalpannerOptionalsourceChecks if the audio is currently playing.
Gets the output node of this playback's audio graph. This is the final node in the internal chain before connection to destination. Use this to manually wire the playback into custom audio graphs.
The gain node that serves as the output of this playback.
The current pitch-shift factor (1 = no shift). See setPitchShift.
Gets the current playback rate of the audio.
Gets the stereo panning value.
The current stereo pan value, or null if stereo panning is not applicable.
Gets the 3D audio options if HRTF panning is used.
The current 3D audio options (HRTF variant).
Sets the 3D audio options for HRTF panning. Accepts either a full ThreeDOptions value or a partial HRTF override. Any field omitted from the input is left at its current value on the underlying PannerNode.
Internal
Materialize a source-level biquad recipe and retain filter API compatibility.
Internal
Source preplay path that preserves synchronous native-build failures.
Build and splice an effect into this live playback's pre-panner chain.
Cancels any in-progress fade, emitting fadeCancel if a fade was active.
Cleans up resources used by the Playback instance. This method should be called when the audio is no longer needed to free up resources.
Creates a clone of the current Playback instance with optional overrides for certain properties. This method allows for the creation of a new Playback instance that shares the same audio context and source node but can have different settings such as loop count or pan type. The clone is connected to the origin Sound's primary route and registered with the Sound.
Configures a fade-out to be applied when the playback ends naturally (last loop iteration).
The fade-out duration in milliseconds.
Optionaltype: FadeType
The fade curve type. Defaults to "linear".
Connects this playback's output to an AudioNode or AudioParam. Follows the Web Audio API connection pattern.
The destination node (for chaining).
Disconnects this playback's output from a specific destination or from all destinations.
Optionaldestination: AudioParam | AudioNode
Optional specific destination to disconnect from. If omitted, disconnects from all destinations.
ProtectedemitProtectedemitProtectedemitFades in from silence to the current volume. Optionally stores config to re-trigger the fade on each loop iteration.
The fade duration in milliseconds.
Optionaltype: FadeType
The fade curve type. Defaults to "linear".
Optionaloptions: { perLoop?: boolean; startTime?: number }
Optional. Set perLoop: true to re-trigger fadeIn on each loop.
Resolves when the fade completes.
Optionaltype: FadeTypeFades the volume to a target value, emitting fadeStart and fadeEnd events.
Optionaloptions: { startTime?: number; startValue?: number }Handles the loop event when the audio ends. This method is bound to the 'onended' event of the audio source. It manages looping logic and restarts playback if necessary.
ProtectedmarkProtectedmarkProtectedmarkRemove event listener.
Register event listener.
Cleanup function
Starts playing the audio.
Optionaloptions: PlayOptionsReturns the instance of the Playback class for chaining.
Optionaloptions: { duration?: number; type?: FadeType }ProtectedsetSets the pitch-shift factor for this playback, resurrecting the dormant phase-vocoder worklet (Jean Laroche & Mark Dolson, "New Phase-Vocoder Techniques for Pitch-Shifting, Harmonizing and Other Exotic Effects", 1999 IEEE WASPAA — peak-based pitch shift with Identity Phase-Locking).
On first use (factor !== 1) the phase-vocoder AudioWorkletNode is built and
added as an ordinary entry at the tail of the pre-panner effect chain:
source → [filters] → phase vocoder → panner → gainNode. The factor is
forwarded to the node's pitchFactor AudioParam (1 = no shift, 2 = +1
octave, 0.5 = -1 octave).
Pitch multiplier (> 0).
Fades out then stops the playback.
The fade-out duration in milliseconds.
Optionaltype: FadeType
The fade curve type. Defaults to "linear".
Resolves when the fade completes and playback is stopped.
The base interface for any sound-producing entity, including individual sounds, groups, and playbacks. BaseSound