Gets or sets the current value
of this AudioParam
. Initially, the value is set to AudioParam.defaultValue
. Part of the Web Audio API.
Though value
can be set, any modifications happening while there are automation events scheduled—that is, events scheduled using the methods of the AudioParam
—are ignored, without raising any exception.
Syntax
var curValue = audioParam.value; audioParam.value = newValue;
Value
A floating-point Number
.
Example
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);
Specifications
Specification | Status | Comment |
---|---|---|
Web Audio API The definition of 'value' in that specification. |
Working Draft |
Browser compatibility
Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | 14 | Yes | 25 | No | 15 | 6 |
Feature | Android webview | Chrome for Android | Edge mobile | Firefox for Android | IE mobile | Opera Android | iOS Safari |
---|---|---|---|---|---|---|---|
Basic support | Yes | 14 | Yes | 26 | No | 15 | ? |
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.