Gets or sets the current value of this AudioParam. Initially, the value is set to AudioParam.defaultValue. Part of the Web Audio API.

Setting value has the same effect as calling AudioParam.setValueAtTime with the current AudioContext's AudioContext.currentTime.


var curValue = audioParam.value;
audioParam.value = newValue;


A floating-point Number indicating the parameter's value. This value will be between the values specified by the minValue and maxValue properties.

Internally, value is stored as a 32-bit floating point number, while JavaScript Numbers are 64-bit. This means the value you obtain from audioParam.value might not equal the value you set it to. Consider the following example:

const source = new AudioBufferSourceNode(...);
const rate = 5.3;
source.playbackRate.value = rate;
console.log(source.playbackRate.value === rate);

The log output will be false, because the playback rate param value was converted to 32-bit, yielding 5.300000190734863. One solution is to wrap values or operations with Math.fround():

const source = new AudioBufferSourceNode(...);
const rate = Math.fround(5.3);
source.playbackRate.value = rate;
console.log(source.playbackRate.value === rate);

In this case, the log output will be true.


This example instantly changes the volume of a GainNode to 40%.

const audioCtx = new AudioContext();
const gainNode = audioCtx.createGain();
gainNode.gain.value = 0.4;
//which is identical to:
gainNode.gain.setValueAtTime(0.4, audioCtx.currentTime);


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

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
valueChrome Full support 14Edge Full support 12Firefox Full support 25IE No support NoOpera Full support 15Safari Full support 6WebView Android Full support YesChrome Android Full support 18Edge Mobile Full support YesFirefox Android Full support 26Opera Android Full support 14Safari iOS Full support YesSamsung Internet Android Full support Yes


Full support  
Full support
No support  
No support

When changing the gain value of a GainNode, Google Chrome prior to version 64 (January 2018) would perform a smooth interpolation to prevent dezippering. Starting with version 64, the value is changed instantly to bring it in line with the Web Audio spec. See Chrome Platform Status for details.

See also

Document Tags and Contributors

Last updated by: mdnwebdocs-bot,