Class: WebAudioContext

webaudio.WebAudioContext

Main class to handle WebAudio API. There's a simple chain of AudioNode elements: analyser > compressor > context.destination. any filters that are added are inserted between the analyser and compressor nodes

Extends

Implements

Members

webaudio.WebAudioContext.AudioContext AudioContext staticreadonly

Get AudioContext class, if not supported returns null

webaudio.WebAudioContext.OfflineAudioContext OfflineAudioContext staticreadonly

Get OfflineAudioContext class, if not supported returns null

analyser AnalyserNode readonly

Context Analyser node

audioContext AudioContext readonly

The WebAudio API AudioContext object.

autoPause boolean

Set to false ignore suspending when window is blurred

Default Value:
  • true

compressor DynamicsCompressorNode readonly

Context Compressor node

events PIXI.EventEmitter

Handle global events

muted boolean

Sets the muted state.

Default Value:
  • false

offlineContext OfflineAudioContext readonly

The WebAudio API OfflineAudioContext object.

paused boolean

Pauses all sounds, even though we handle this at the instance level, we'll also pause the audioContext so that the time used to compute progress isn't messed up.

Default Value:
  • false

speed number readonly

Global speed of all sounds

volume number

Sets the volume from 0 to 1.

Default Value:
  • 1

Methods

decode (arrayBuffer, callback) void

Decode the audio data

Name Type Description
arrayBuffer ArrayBuffer

Buffer from loader

callback (err: Error, buffer: AudioBuffer) => void

When completed, error and audioBuffer are parameters.

destroy () void overrides

Destroy this context.

playEmptySound () void

Plays an empty sound in the web audio context. This is used to enable web audio on iOS devices, as they require the first sound to be played inside of a user initiated event (touch/click).

refresh () void

Emit event when muted, volume or speed changes

refreshPaused () void

Emit event when muted, volume or speed changes

toggleMute () boolean

Toggles the muted state.

Returns:
Type Description
boolean The current muted state.

togglePause () boolean

Toggles the paused state.

Returns:
Type Description
boolean The current muted state.

Inherited Properties

From class Filterable

destination AudioNode inherited

The destination output audio node

The collection of filters.