WebAudioInstance
Implements
Index
Constructors
constructor
Parameters
_src: AudioBuffer
Returns WebAudioInstance
Accessors
publicduration
Returns the set duration to play, otherwise returns the total duration if unset
Returns number
Set the duration that this audio should play.
Note: if you seek to a specific point the duration will start from that point, for example
If you have a 10 second clip, seek to 5 seconds, then set the duration to 2, it will play the clip from 5-7 seconds.
Parameters
duration: number
Returns void
publicloop
Whether the audio should loop (repeat forever)
Returns boolean
Whether the audio should loop (repeat forever)
Parameters
value: boolean
Returns void
publicplaybackRate
Set the playbackRate, default is 1.0 at normal speed. For example 2.0 is double speed, and 0.5 is half speed.
Returns number
Set the playbackRate, default is 1.0 at normal speed. For example 2.0 is double speed, and 0.5 is half speed.
Parameters
playbackRate: number
Returns void
publicvolume
The volume (between 0 and 1)
Returns number
The volume (between 0 and 1)
Parameters
value: number
Returns void
Methods
publicgetPlaybackPosition
Return the current playback time of the playing track in seconds from the start
Returns number
publicgetTotalPlaybackDuration
Return the duration of the sound
Returns number
publicisPaused
Returns if the audio is paused
Returns boolean
publicisPlaying
Whether or not any audio is playing
Returns boolean
publicisStopped
Returns if the audio is stopped
Returns boolean
publicpause
Pause the sound
Returns void
publicplay
Will play the sound or resume if paused
Parameters
playStarted: () => any = ...
Returns Promise<boolean>
publicseek
Seek to a position (in seconds) in the audio
Parameters
position: number
Returns void
publicstop
Stop playing the sound and reset
Returns void
Internal class representing a Web Audio AudioBufferSourceNode instance
https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API