AudioParam

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

* Some parts of this feature may have varying levels of support.

The Web Audio API's AudioParam interface represents an audio-related parameter, usually a parameter of an AudioNode (such as GainNode.gain).

An AudioParam can be set to a specific value or a change in value, and can be scheduled to happen at a specific time and following a specific pattern.

Each AudioParam has a list of events, initially empty, that define when and how values change. When this list is not empty, changes using the AudioParam.value attributes are ignored. This list of events allows us to schedule changes that have to happen at very precise times, using arbitrary timeline-based automation curves. The time used is the one defined in AudioContext.currentTime.

AudioParam types

There are two AudioParam kinds: a-rate and k-rate parameters. Each AudioNode defines which of its parameters are a-rate or k-rate in the spec.

a-rate

An a-rate AudioParam takes the current audio parameter value for each sample frame of the audio signal.

k-rate

A k-rate AudioParam uses the same initial audio parameter value for the whole block processed; that is, 128 sample frames. In other words, the same value applies to every frame in the audio as it's processed by the node.

Instance properties

AudioParam.defaultValue Read only

Represents the initial value of the attribute as defined by the specific AudioNode creating the AudioParam.

AudioParam.maxValue Read only

Represents the maximum possible value for the parameter's nominal (effective) range.

AudioParam.minValue Read only

Represents the minimum possible value for the parameter's nominal (effective) range.

AudioParam.value

Represents the parameter's current value as of the current time; initially set to the value of defaultValue.

Instance methods

AudioParam.setValueAtTime()

Schedules an instant change to the value of the AudioParam at a precise time, as measured against AudioContext.currentTime. The new value is given by the value parameter.

AudioParam.linearRampToValueAtTime()

Schedules a gradual linear change in the value of the AudioParam. The change starts at the time specified for the previous event, follows a linear ramp to the new value given in the value parameter, and reaches the new value at the time given in the endTime parameter.

AudioParam.exponentialRampToValueAtTime()

Schedules a gradual exponential change in the value of the AudioParam. The change starts at the time specified for the previous event, follows an exponential ramp to the new value given in the value parameter, and reaches the new value at the time given in the endTime parameter.

AudioParam.setTargetAtTime()

Schedules the start of a change to the value of the AudioParam. The change starts at the time specified in startTime and exponentially moves towards the value given by the target parameter. The exponential decay rate is defined by the timeConstant parameter, which is a time measured in seconds.

AudioParam.setValueCurveAtTime()

Schedules the values of the AudioParam to follow a set of values, defined by an array of floating-point numbers scaled to fit into the given interval, starting at a given start time and spanning a given duration of time.

AudioParam.cancelScheduledValues()

Cancels all scheduled future changes to the AudioParam.

AudioParam.cancelAndHoldAtTime()

Cancels all scheduled future changes to the AudioParam but holds its value at a given time until further changes are made using other methods.

Examples

First, a basic example showing a GainNode having its gain value set. gain is an example of an a-rate AudioParam, as the value can potentially be set differently for each sample frame of the audio.

js
const audioCtx = new AudioContext();

const gainNode = audioCtx.createGain();
gainNode.gain.value = 0;

Next, an example showing a DynamicsCompressorNode having some param values manipulated. These are examples of k-rate AudioParam types, as the values are set for the entire audio block at once.

js
const compressor = audioCtx.createDynamicsCompressor();
compressor.threshold.setValueAtTime(-50, audioCtx.currentTime);
compressor.knee.setValueAtTime(40, audioCtx.currentTime);
compressor.ratio.setValueAtTime(12, audioCtx.currentTime);
compressor.attack.setValueAtTime(0, audioCtx.currentTime);
compressor.release.setValueAtTime(0.25, audioCtx.currentTime);

Specifications

Specification
Web Audio API
# AudioParam

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
AudioParam
Chrome – Full support
Chrome 14 (Release date: 2011-09-16)
footnote Full support
Edge – Full support
Edge 12 (Release date: 2015-07-29)
footnote Full support
Firefox – Full support
Firefox 25 (Release date: 2013-10-29)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 6 (Release date: 2012-07-25)
footnote Full support
Chrome Android – Full support
Chrome Android 18 (Release date: 2012-06-27)
footnote Full support
Firefox for Android – Full support
Firefox for Android 25 (Release date: 2013-10-29)
footnote Full support
Opera Android – Full support
Opera Android 14 (Release date: 2013-05-21)
footnote Full support
Safari on iOS – Full support
Safari on iOS 6 (Release date: 2012-09-10)
footnote Full support
Samsung Internet – Full support
Samsung Internet 1 (Release date: 2013-04-27)
footnote Full support
WebView Android – Full support
WebView Android 4.4 (Release date: 2013-12-09)
footnote Full support
WebView on iOS – Full support
WebView on iOS 6 (Release date: 2012-09-10)
footnote Full support
automationRate
Chrome – Full support
Chrome 68 (Release date: 2018-07-24)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – No support
Firefox
footnote
footnote See bug 1504984
Opera – Full support
Opera 55 (Release date: 2018-08-16)
footnote Full support
Safari – Full support
Safari 14 (Release date: 2020-09-16)
footnote Full support
Chrome Android – Full support
Chrome Android 68 (Release date: 2018-07-24)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote
footnote See bug 1504984
Opera Android – Full support
Opera Android 48 (Release date: 2018-11-08)
footnote Full support
Safari on iOS – Full support
Safari on iOS 14 (Release date: 2020-09-16)
footnote Full support
Samsung Internet – Full support
Samsung Internet 10 (Release date: 2019-08-22)
footnote Full support
WebView Android – Full support
WebView Android 68 (Release date: 2018-07-24)
footnote Full support
WebView on iOS – Full support
WebView on iOS 14 (Release date: 2020-09-16)
footnote Full support
cancelAndHoldAtTime
Chrome – Full support
Chrome 57 (Release date: 2017-03-09)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – No support
Firefox
footnote
footnote See bug 1308431
Opera – Full support
Opera 44 (Release date: 2017-03-21)
footnote Full support
Safari – Full support
Safari 14.1 (Release date: 2021-04-26)
footnote Full support
Chrome Android – Full support
Chrome Android 57 (Release date: 2017-03-16)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote
footnote See bug 1308431
Opera Android – Full support
Opera Android 43 (Release date: 2017-09-27)
footnote Full support
Safari on iOS – Full support
Safari on iOS 14.5 (Release date: 2021-04-26)
footnote Full support
Samsung Internet – Full support
Samsung Internet 7 (Release date: 2018-03-16)
footnote Full support
WebView Android – Full support
WebView Android 57 (Release date: 2017-03-16)
footnote Full support
WebView on iOS – Full support
WebView on iOS 14.5 (Release date: 2021-04-26)
footnote Full support
cancelScheduledValues
Chrome – Partial support
Chrome 14 – 81 (Release date: 2011-09-16)
footnote Partial support
footnote Before Chrome 83, cancelScheduledValues() does not cancel in-progress curve events created by setValueCurveAtTime(). See bug 40123334.
Chrome – Full support
Chrome 83 (Release date: 2020-05-19)
footnote Full support
Edge – Partial support
Edge 12 – 81 (Release date: 2015-07-29)
footnote Partial support
footnote Before Edge 83, cancelScheduledValues() does not cancel in-progress curve events created by setValueCurveAtTime().
Edge – Full support
Edge 83 (Release date: 2020-05-21)
footnote Full support
Firefox – Partial support
Firefox 25 (Release date: 2013-10-29)
footnote Partial support
footnote Does not cancel in-progress curve events created by setValueCurveAtTime(). See bug 1752775.
Opera – Partial support
Opera 15 – 68 (Release date: 2013-07-02)
footnote Partial support
footnote Before Opera 69, cancelScheduledValues() does not cancel in-progress curve events created by setValueCurveAtTime(). See bug 40123334.
Opera – Full support
Opera 69 (Release date: 2020-06-24)
footnote Full support
Safari – Partial support
Safari 6 – 14 (Release date: 2012-07-25)
footnote Partial support
footnote Before Safari 14.1, cancelScheduledValues() does not cancel in-progress curve events created by setValueCurveAtTime(). See bug 216132.
Safari – Full support
Safari 14.1 (Release date: 2021-04-26)
footnote Full support
Chrome Android – Partial support
Chrome Android 18 – 81 (Release date: 2012-06-27)
footnote Partial support
footnote Before Chrome Android 83, cancelScheduledValues() does not cancel in-progress curve events created by setValueCurveAtTime(). See bug 40123334.
Chrome Android – Full support
Chrome Android 83 (Release date: 2020-05-19)
footnote Full support
Firefox for Android – Partial support
Firefox for Android 25 (Release date: 2013-10-29)
footnote Partial support
footnote Does not cancel in-progress curve events created by setValueCurveAtTime(). See bug 1752775.
Opera Android – Partial support
Opera Android 14 – 58 (Release date: 2013-05-21)
footnote Partial support
footnote Before Opera Android 59, cancelScheduledValues() does not cancel in-progress curve events created by setValueCurveAtTime(). See bug 40123334.
Opera Android – Full support
Opera Android 59 (Release date: 2020-06-30)
footnote Full support
Safari on iOS – Partial support
Safari on iOS 6 – 14 (Release date: 2012-09-10)
footnote Partial support
footnote Before Safari on iOS 14.1, cancelScheduledValues() does not cancel in-progress curve events created by setValueCurveAtTime(). See bug 216132.
Safari on iOS – Full support
Safari on iOS 14.5 (Release date: 2021-04-26)
footnote Full support
Samsung Internet – Partial support
Samsung Internet 1 – 12.1 (Release date: 2013-04-27)
footnote Partial support
footnote Before Samsung Internet 13.0, cancelScheduledValues() does not cancel in-progress curve events created by setValueCurveAtTime(). See bug 40123334.
Samsung Internet – Full support
Samsung Internet 13 (Release date: 2020-12-02)
footnote Full support
WebView Android – Partial support
WebView Android 4.4 – 81 (Release date: 2013-12-09)
footnote Partial support
footnote Before WebView Android 83, cancelScheduledValues() does not cancel in-progress curve events created by setValueCurveAtTime(). See bug 40123334.
WebView Android – Full support
WebView Android 83 (Release date: 2020-05-19)
footnote Full support
WebView on iOS – Partial support
WebView on iOS 6 – 14 (Release date: 2012-09-10)
footnote Partial support
footnote Before WebView on iOS 14.1, cancelScheduledValues() does not cancel in-progress curve events created by setValueCurveAtTime(). See bug 216132.
WebView on iOS – Full support
WebView on iOS 14.5 (Release date: 2021-04-26)
footnote Full support
defaultValue
Chrome – Full support
Chrome 14 (Release date: 2011-09-16)
footnote Full support
Edge – Full support
Edge 12 (Release date: 2015-07-29)
footnote Full support
Firefox – Full support
Firefox 25 (Release date: 2013-10-29)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 6 (Release date: 2012-07-25)
footnote Full support
Chrome Android – Full support
Chrome Android 18 (Release date: 2012-06-27)
footnote Full support
Firefox for Android – Full support
Firefox for Android 25 (Release date: 2013-10-29)
footnote Full support
Opera Android – Full support
Opera Android 14 (Release date: 2013-05-21)
footnote Full support
Safari on iOS – Full support
Safari on iOS 6 (Release date: 2012-09-10)
footnote Full support
Samsung Internet – Full support
Samsung Internet 1 (Release date: 2013-04-27)
footnote Full support
WebView Android – Full support
WebView Android 4.4 (Release date: 2013-12-09)
footnote Full support
WebView on iOS – Full support
WebView on iOS 6 (Release date: 2012-09-10)
footnote Full support
exponentialRampToValueAtTime
Chrome – Full support
Chrome 14 (Release date: 2011-09-16)
footnote Full support
Edge – Full support
Edge 12 (Release date: 2015-07-29)
footnote Full support
Firefox – Partial support
Firefox 25 (Release date: 2013-10-29)
footnote Partial support
footnote Sometimes jumps to value immediately. See bug 2011524.
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 6 (Release date: 2012-07-25)
footnote Full support
Chrome Android – Partial support
Chrome Android 18 (Release date: 2012-06-27)
footnote Partial support
footnote Behaves like setValueAtTime(): Sets the target volume at the specified time, but doesn't ramp to it.
Firefox for Android – Partial support
Firefox for Android 25 (Release date: 2013-10-29)
footnote Partial support
footnote Sometimes jumps to value immediately. See bug 2011524.
Opera Android – Full support
Opera Android 14 (Release date: 2013-05-21)
footnote Full support
Safari on iOS – Full support
Safari on iOS 6 (Release date: 2012-09-10)
footnote Full support
Samsung Internet – Full support
Samsung Internet 1 (Release date: 2013-04-27)
footnote Full support
WebView Android – Partial support
WebView Android 4.4 (Release date: 2013-12-09)
footnote Partial support
footnote Behaves like setValueAtTime(): Sets the target volume at the specified time, but doesn't ramp to it.
WebView on iOS – Full support
WebView on iOS 6 (Release date: 2012-09-10)
footnote Full support
linearRampToValueAtTime
Chrome – Full support
Chrome 14 (Release date: 2011-09-16)
footnote Full support
Edge – Full support
Edge 12 (Release date: 2015-07-29)
footnote Full support
Firefox – Partial support
Firefox 25 (Release date: 2013-10-29)
footnote Partial support
footnote Sometimes jumps to value immediately. See bug 2011524.
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 6 (Release date: 2012-07-25)
footnote Full support
Chrome Android – Partial support
Chrome Android 18 (Release date: 2012-06-27)
footnote Partial support
footnote Behaves like setValueAtTime(): Sets the target volume at the specified time, but doesn't ramp to it.
Firefox for Android – Partial support
Firefox for Android 25 (Release date: 2013-10-29)
footnote Partial support
footnote Sometimes jumps to value immediately. See bug 2011524.
Opera Android – Full support
Opera Android 14 (Release date: 2013-05-21)
footnote Full support
Safari on iOS – Full support
Safari on iOS 6 (Release date: 2012-09-10)
footnote Full support
Samsung Internet – Full support
Samsung Internet 1 (Release date: 2013-04-27)
footnote Full support
WebView Android – Partial support
WebView Android 4.4 (Release date: 2013-12-09)
footnote Partial support
footnote Behaves like setValueAtTime(): Sets the target volume at the specified time, but doesn't ramp to it.
WebView on iOS – Full support
WebView on iOS 6 (Release date: 2012-09-10)
footnote Full support
maxValue
Chrome – Full support
Chrome 52 (Release date: 2016-07-20)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 53 (Release date: 2017-04-19)
footnote Full support
Opera – Full support
Opera 39 (Release date: 2016-08-02)
footnote Full support
Safari – Full support
Safari 6 (Release date: 2012-07-25)
footnote Full support
Chrome Android – Full support
Chrome Android 52 (Release date: 2016-07-27)
footnote Full support
Firefox for Android – Full support
Firefox for Android 53 (Release date: 2017-04-19)
footnote Full support
Opera Android – Full support
Opera Android 41 (Release date: 2016-10-25)
footnote Full support
Safari on iOS – Full support
Safari on iOS 6 (Release date: 2012-09-10)
footnote Full support
Samsung Internet – Full support
Samsung Internet 6 (Release date: 2017-08-23)
footnote Full support
WebView Android – Full support
WebView Android 52 (Release date: 2016-07-27)
footnote Full support
WebView on iOS – Full support
WebView on iOS 6 (Release date: 2012-09-10)
footnote Full support
minValue
Chrome – Full support
Chrome 52 (Release date: 2016-07-20)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 53 (Release date: 2017-04-19)
footnote Full support
Opera – Full support
Opera 39 (Release date: 2016-08-02)
footnote Full support
Safari – Full support
Safari 6 (Release date: 2012-07-25)
footnote Full support
Chrome Android – Full support
Chrome Android 52 (Release date: 2016-07-27)
footnote Full support
Firefox for Android – Full support
Firefox for Android 53 (Release date: 2017-04-19)
footnote Full support
Opera Android – Full support
Opera Android 41 (Release date: 2016-10-25)
footnote Full support
Safari on iOS – Full support
Safari on iOS 6 (Release date: 2012-09-10)
footnote Full support
Samsung Internet – Full support
Samsung Internet 6 (Release date: 2017-08-23)
footnote Full support
WebView Android – Full support
WebView Android 52 (Release date: 2016-07-27)
footnote Full support
WebView on iOS – Full support
WebView on iOS 6 (Release date: 2012-09-10)
footnote Full support
setTargetAtTime
Chrome – No support
Chrome 14 – 23 (Release date: 2011-09-16)
altname
altname Alternate name: setTargetValueAtTime
Chrome – Full support
Chrome 24 (Release date: 2013-01-10)
footnote Full support
Edge – Full support
Edge 12 (Release date: 2015-07-29)
footnote Full support
Firefox – Full support
Firefox 25 (Release date: 2013-10-29)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 6 (Release date: 2012-07-25)
footnote Full support
Chrome Android – No support
Chrome Android 18 – 18 (Release date: 2012-06-27)
altname
altname Alternate name: setTargetValueAtTime
Chrome Android – Full support
Chrome Android 25 (Release date: 2013-02-27)
footnote Full support
Firefox for Android – Full support
Firefox for Android 25 (Release date: 2013-10-29)
footnote Full support
Opera Android – Full support
Opera Android 14 (Release date: 2013-05-21)
footnote Full support
Safari on iOS – Full support
Safari on iOS 6 (Release date: 2012-09-10)
footnote Full support
Samsung Internet – No support
Samsung Internet 1 – 1 (Release date: 2013-04-27)
altname
altname Alternate name: setTargetValueAtTime
Samsung Internet – Full support
Samsung Internet 1.5 (Release date: 2013-09-25)
footnote Full support
WebView Android – Full support
WebView Android 4.4 (Release date: 2013-12-09)
footnote Full support
WebView on iOS – Full support
WebView on iOS 6 (Release date: 2012-09-10)
footnote Full support
setValueAtTime
Chrome – Full support
Chrome 14 (Release date: 2011-09-16)
footnote Full support
Edge – Full support
Edge 12 (Release date: 2015-07-29)
footnote Full support
Firefox – Full support
Firefox 25 (Release date: 2013-10-29)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 6 (Release date: 2012-07-25)
footnote Full support
Chrome Android – Full support
Chrome Android 18 (Release date: 2012-06-27)
footnote Full support
Firefox for Android – Full support
Firefox for Android 25 (Release date: 2013-10-29)
footnote Full support
Opera Android – Full support
Opera Android 14 (Release date: 2013-05-21)
footnote Full support
Safari on iOS – Full support
Safari on iOS 6 (Release date: 2012-09-10)
footnote Full support
Samsung Internet – Full support
Samsung Internet 1 (Release date: 2013-04-27)
footnote Full support
WebView Android – Full support
WebView Android 4.4 (Release date: 2013-12-09)
footnote Full support
WebView on iOS – Full support
WebView on iOS 6 (Release date: 2012-09-10)
footnote Full support
setValueCurveAtTime
Chrome – Full support
Chrome 14 (Release date: 2011-09-16)
footnote Full support
Edge – Full support
Edge 12 (Release date: 2015-07-29)
footnote Full support
Firefox – Full support
Firefox 25 (Release date: 2013-10-29)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 6 (Release date: 2012-07-25)
footnote Full support
Chrome Android – Full support
Chrome Android 18 (Release date: 2012-06-27)
footnote Full support
Firefox for Android – Full support
Firefox for Android 25 (Release date: 2013-10-29)
footnote Full support
Opera Android – Full support
Opera Android 14 (Release date: 2013-05-21)
footnote Full support
Safari on iOS – Full support
Safari on iOS 6 (Release date: 2012-09-10)
footnote Full support
Samsung Internet – Full support
Samsung Internet 1 (Release date: 2013-04-27)
footnote Full support
WebView Android – Full support
WebView Android 4.4 (Release date: 2013-12-09)
footnote Full support
WebView on iOS – Full support
WebView on iOS 6 (Release date: 2012-09-10)
footnote Full support
value
Chrome – Full support
Chrome 14 (Release date: 2011-09-16)
footnote
footnote Before version 66, the gain value of a GainNode would perform a smooth interpolation to prevent dezippering (instead of changing instantly).
Edge – Full support
Edge 12 (Release date: 2015-07-29)
footnote Full support
Firefox – Full support
Firefox 25 (Release date: 2013-10-29)
footnote
footnote Before Firefox 134, setting value was ignored when done at the same time as scheduled automation events.
footnote Before Firefox 69, value did not take into account scheduled or gradiated changes to the parameter's value; instead, only explicitly set values were returned.
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote
footnote Before version 53, the gain value of a GainNode would perform a smooth interpolation to prevent dezippering (instead of changing instantly).
Safari – Full support
Safari 6 (Release date: 2012-07-25)
footnote Full support
Chrome Android – Full support
Chrome Android 18 (Release date: 2012-06-27)
footnote
footnote Before version 66, the gain value of a GainNode would perform a smooth interpolation to prevent dezippering (instead of changing instantly).
Firefox for Android – Full support
Firefox for Android 25 (Release date: 2013-10-29)
footnote
footnote Firefox for Android does not currently take into account scheduled or gradiated changes to the parameter's value; only the initial value or the most recent explicitly set value is returned.
Opera Android – Full support
Opera Android 14 (Release date: 2013-05-21)
footnote
footnote Before version 47, the gain value of a GainNode would perform a smooth interpolation to prevent dezippering (instead of changing instantly).
Safari on iOS – Full support
Safari on iOS 6 (Release date: 2012-09-10)
footnote Full support
Samsung Internet – Full support
Samsung Internet 1 (Release date: 2013-04-27)
footnote
footnote Before version 9.0, the gain value of a GainNode would perform a smooth interpolation to prevent dezippering (instead of changing instantly).
WebView Android – Full support
WebView Android 4.4 (Release date: 2013-12-09)
footnote
footnote Before version 66, the gain value of a GainNode would perform a smooth interpolation to prevent dezippering (instead of changing instantly).
WebView on iOS – Full support
WebView on iOS 6 (Release date: 2012-09-10)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
No support
No support
See implementation notes.
Uses a non-standard name
Has more compatibility info.

See also