AudioParamDescriptor
TheAudioParamDescriptor dictionary of theWeb Audio API specifies properties forAudioParam objects.
It is used to create customAudioParams 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
nameThe string which represents the name of the
AudioParam. Under this name theAudioParamwill be available in theparametersproperty of the node, and under this name theAudioWorkletProcessor.processmethod will acquire the calculated values of thisAudioParam.automationRateOptionalEither
"a-rate", or"k-rate"string which represents an automation rate of thisAudioParam. Defaults to"a-rate".minValueOptionalA
floatwhich represents minimum value of theAudioParam. Defaults to-3.4028235e38.maxValueOptionalA
floatwhich represents maximum value of theAudioParam. Defaults to3.4028235e38.defaultValueOptionalA
floatwhich 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> |