Skip to main content

AudioContext

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

Constructor

new AudioContext(options: AudioContextOptions)

interface AudioContextOptions {
sampleRate: number;
initSuspended: boolean;
}

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

Closes the audio context, releasing any system audio resources that it uses.

Returns Promise<undefined>.

suspend

Suspends time progression in the audio context. It is useful when your application will not use audio for a while.

Returns Promise<boolean>.

resume

Resumes a previously suspended audio context.

Returns Promise<boolean>.