Firefox Tomorrow

web api interface

BaseAudioContext

View on MDN ↗

The BaseAudioContext interface of the Web Audio API acts as a base definition for online and offline audio-processing graphs, as represented by AudioContext and OfflineAudioContext respectively. You wouldn’t use BaseAudioContext directly — you’d use its features via one of these two inheriting interfaces.

A BaseAudioContext can be a target of events, therefore it implements the EventTarget interface.

Instance properties

  • audioWorklet Read only
  • currentTime Read only
    • : Returns a double representing an ever-increasing hardware time in seconds used for scheduling. It starts at 0.
  • destination Read only
    • : Returns an AudioDestinationNode representing the final destination of all audio in the context. It can be thought of as the audio-rendering device.
  • listener Read only
    • : Returns the AudioListener object, used for 3D spatialization.
  • sampleRate Read only
    • : Returns a float representing the sample rate (in samples per second) used by all nodes in this context. The sample-rate of an AudioContext cannot be changed.
  • state Read only
    • : Returns the current state of the AudioContext.

Instance methods

Also implements methods from the interface EventTarget.

Events

Examples

const audioContext = new AudioContext();

const oscillatorNode = audioContext.createOscillator();
const gainNode = audioContext.createGain();
const finish = audioContext.destination;

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also