Skip to main content

PlayOptions

One-off overrides for a single playback, see Sound.play. Unset options fall back to the Sound's configuration; nothing here changes the Sound itself.

Index

Properties

optionalduration

duration?: number

Duration in seconds to play this track for, overrides Sound.duration

optionalloop

loop?: boolean

Loop this track, overrides Sound.loop

optionalonPlay

Audio graph hook for this track (and its later resumes), overrides Sound.onPlay. See AudioGraphBuilder.

optionalpitch

pitch?: number

Pitch shift in cents for this track, overrides Sound.pitch

optionalplaybackRate

playbackRate?: number

Playback speed multiplier for this track, overrides Sound.playbackRate

optionalposition

position?: number

Position in seconds to start this track from, overrides Sound.position

optionalscheduledStartTime

scheduledStartTime?: number

Schedule time to play in milliseconds from the audio context origin

Compute using the audio context

const sound: Sound = ...;
const oneThousandMillisecondsFromNow = AudioContextFactory.currentTime() + 1000;

sound.play({ scheduledStartTime: oneThousandMillisecondsFromNow });

optionalvolume

volume?: number

Volume [0-1] of this track, multiplied with Sound.volume. Default 1.