AudioParam.value

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

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support14 Yes25 No156
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidIE mobileOpera AndroidiOS Safari
Basic support Yes14 Yes26 No15 ?

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

 Contributors to this page: Jedipedia, fscholz, chrisdavidmills, erikadoyle
 Last updated by: Jedipedia,