MDN wants to learn about developers like you: https://qsurvey.mozilla.com/s3/MDN-dev-survey

This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.

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
Options are as follows:
  • latencyHint: This value identifies type of playback, which affects tradeoffs between audio output latency and power consumption. The prefered values are "balanced", "interactive", and "playback", with the default value: "interactive". These values mean "balance audio output latency and power consumption", "provide lowest audio output latency as possible without glitching", and "prioritize sustained playback without interruption over audio output latency". You can also specify double value for the number of seconds of latency, for finer control.

Specifications

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

Browser Compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 55.0 25 (25) ? 42 ?
options parameter ? No support[1] ? ? ?
Feature Android Android Webview Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support No support 55.0 25.0 (25) ? 42 ? 55.0
options parameter No support ? No support ? ? ? ?

[1] Firefox does not yet support the options parameter. However, from Firefox 31 through 54, Firefox had a non-standard constructor which accepted as input a string identifying the purpose for which the channel was being used. This was removed in Firefox 55 since it was causing code that used the options parameter to throw an exception. Support for options will arrive in the future.

Document Tags and Contributors

 Contributors to this page: Sheppy, bunnybooboo, chaser, chikoski, jpmedley
 Last updated by: Sheppy,