AudioParamDescriptor
TheAudioParamDescriptor
dictionary of theWeb Audio API specifies properties forAudioParam
objects.
It is used to create customAudioParam
s on anAudioWorkletNode
. If the underlyingAudioWorkletProcessor
has aparameterDescriptors
static getter, then the returned array of objects based on this dictionary is used internally byAudioWorkletNode
constructor to populate itsparameters
property accordingly.
In this article
Instance properties
name
The string which represents the name of the
AudioParam
. Under this name theAudioParam
will be available in theparameters
property of the node, and under this name theAudioWorkletProcessor.process
method will acquire the calculated values of thisAudioParam
.automationRate
OptionalEither
"a-rate"
, or"k-rate"
string which represents an automation rate of thisAudioParam
. Defaults to"a-rate"
.minValue
OptionalA
float
which represents minimum value of theAudioParam
. Defaults to-3.4028235e38
.maxValue
OptionalA
float
which represents maximum value of theAudioParam
. Defaults to3.4028235e38
.defaultValue
OptionalA
float
which represents initial value of theAudioParam
. Defaults to0
.
Examples
The code fragment below shows a descriptor of this type being returned by a staticparameterDescriptors
method defined in a customAudioWorkletProcessor
(this is part of the more complete example inAudioWorkletNode.parameters).
// white-noise-processor.jsclass WhiteNoiseProcessor extends AudioWorkletProcessor { static get parameterDescriptors() { return [ { name: "customGain", defaultValue: 1, minValue: 0, maxValue: 1, automationRate: "a-rate", }, ]; } // …}
Specifications
Specification |
---|
Web Audio API> # AudioParamDescriptor> |