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.
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.
The default value of minValue
is the minimum negative single-precision floating-point value (-340,282,346,638,528,859,811,704,183,484,516,925,440), and the default value of maxValue
is the maximum positive single-precision floating-point value (+340,282,346,638,528,859,811,704,183,484,516,925,440).
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 |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | 14 | 12 | 25 | No | 15 | 6 |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | Yes | 18 | Yes | 26 | 15 | ? | Yes |
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.
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/AudioParam/value