The AudioContextOptions dictionary (used when instantiating an AudioContext) may contain a property named sampleRate, which indicates the sample rate to use for the new context. The value must be a floating-point value indicating the sample rate, in samples per second, for which to configure the new context; additionally, the value must be one which is supported by AudioBuffer.sampleRate.


audioContextOptions.sampleRate = 44100;

var sampleRate = audioContextOptions.sampleRate;


The desired sample rate for the AudioContext, specified in samples per second. The value must be compatible with AudioBuffer.sampleRate. This value should typically be between 8,000 Hz and 96,000 Hz; the default will vary depending on the output device, but the sample rate 44,100 Hz is the most common.

If the sampleRate property is not included in the options, or the options are not specified when creating the audio context, the new context's output device's preferred sample rate is used by default.


Specification Status Comment
Web Audio API
The definition of 'AudioContextOptions.sampleRate' in that specification.
Working Draft Initial definition.

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
sampleRateChrome No support No
No support No
Notes See issue 432248 for Chrome support.
Edge No support NoFirefox Full support 61IE No support NoOpera No support NoSafari ? WebView Android No support NoChrome Android ? Edge Mobile No support NoFirefox Android Full support 61Opera Android ? Safari iOS ? Samsung Internet Android ?


Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
See implementation notes.
See implementation notes.

See also

Document Tags and Contributors

Contributors to this page: mdnwebdocs-bot, Sheppy
Last updated by: mdnwebdocs-bot,