The AudioContext() constructor creates a new AudioContext object which represents an audio-processing graph, built from audio modules linked together, each represented by an AudioNode.

Syntax

var audioContext = new AudioContext(options)

Parameters

options Optional
An object containing option properties that can be set when creating the object instance. Available properties are as follows:
  • latencyHint: A string or double value that identifies type of playback, affecting tradeoffs between audio output latency and power consumption. The default value is interactive. Although finer control can be achieved by passing a double value (indiciating number of seconds of latency), the preferred values are as follows:
    • balanced, balances audio output latency and power consumption.
    • interactive, provides lowest audio output latency as possible without glitching.
    • playback, prioritizes sustained playback without interruption over audio output latency.

Specifications

Specification Status Comment
Web Audio API
The definition of 'AudioContext()' in that specification.
Working Draft Initial definition.

Browser Compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic Support55 ?25 No42 ?
options parameter60 ? No No47 ?
FeatureAndroidChrome for AndroidEdge mobileFirefox for AndroidIE mobileOpera AndroidiOS Safari
Basic Support5555 ?25 No42 ?
options parameter6060 ? No No47 ?

Document Tags and Contributors

 Last updated by: fscholz,