docs.rodeo

MDN Web Docs mirror

AudioContext

{{APIRef("Web Audio API")}} 

The AudioContext interface represents an audio-processing graph built from audio modules linked together, each represented by an {{domxref("AudioNode")}} .

An audio context controls both the creation of the nodes it contains and the execution of the audio processing, or decoding. You need to create an AudioContext before you do anything else, as everything happens inside a context. It’s recommended to create one AudioContext and reuse it instead of initializing a new one each time, and it’s OK to use a single AudioContext for several different audio sources and pipeline concurrently.

{{InheritanceDiagram}} 

Constructor

Instance properties

Also inherits properties from its parent interface, {{domxref("BaseAudioContext")}} .

Instance methods

Also inherits methods from its parent interface, {{domxref("BaseAudioContext")}} .

Events

Examples

Basic audio context declaration:

const audioCtx = new AudioContext();

const oscillatorNode = audioCtx.createOscillator();
const gainNode = audioCtx.createGain();
const finish = audioCtx.destination;
// etc.

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN