The Web Audio API's AudioParam
interface represents an audio-related parameter, usually a parameter of an AudioNode
(such as GainNode.gain
).
Documentation AudioParam by Mozilla Contributors, licensed under CC-BY-SA 2.5.
See also:
Variables
read onlydefaultValue:Float
Represents the initial volume of the attribute as defined by the specific AudioNode
creating the AudioParam
.
read onlymaxValue:Float
Represents the maximum possible value for the parameter's nominal (effective) range.
read onlyminValue:Float
Represents the minimum possible value for the parameter's nominal (effective) range.
value:Float
Represents the parameter's current volume as a floating point value; initially set to the value of AudioParam.defaultValue
. Though it 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.
Methods
cancelScheduledValues(startTime:Float):AudioParam
exponentialRampToValueAtTime(value:Float, endTime:Float):AudioParam
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.
Throws:
null | DOMError |
---|
linearRampToValueAtTime(value:Float, endTime:Float):AudioParam
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.
Throws:
null | DOMError |
---|
setTargetAtTime(target:Float, startTime:Float, timeConstant:Float):AudioParam
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.
Throws:
null | DOMError |
---|
setValueAtTime(value:Float, startTime:Float):AudioParam
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.
Throws:
null | DOMError |
---|
setValueCurveAtTime(values:Array<Float>, startTime:Float, duration:Float):AudioParam
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.
Throws:
null | DOMError |
---|