Nos bénévoles n'ont pas encore traduit cet article en Français. Inscrivez-vous et aidez-nous à réaliser cette tâche !
Vous pouvez également lire cet article en English (US).

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 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).

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

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic supportChrome 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 15Safari iOS ? Samsung Internet Android Full support Yes

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown

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

Étiquettes et contributeurs liés au document

Contributeurs à cette page : Sheppy, Jedipedia, fscholz, chrisdavidmills, erikadoyle
Dernière mise à jour par : Sheppy,