Skip to main content

AudioContext

The AudioContext interface inherits from BaseAudioContext. It is responsible for supervising and managing audio-processing graph.

Constructor

new AudioContext()

new AudioContext(options: AudioContextOptions)

Errors

Error typeDescription
NotSupportedErrorsampleRate is outside the nominal range [8000, 96000].

Properties

AudioContext does not define any additional properties. It inherits all properties from BaseAudioContext.

Methods

It inherits all methods from BaseAudioContext.

close

The above method lets you close the audio context, releasing any system audio resources that it uses.

Returns Promise<undefined>.

suspend

The above method lets you suspend time progression in the audio context. It is useful when your application will not use audio for a while.

Returns Promise<boolean>.

resume

The above method lets resume time progression in audio context that previously has been suspended.

Returns Promise<boolean>.

Remarks

AudioContextOptions

Details

AudioContextOptions is a dictionary object, which specifies sample rate for the new context.

interface AudioContextOptions {
sampleRate: number;
}