diff --git a/files/en-us/web/api/audioparamdescriptor/index.html b/files/en-us/web/api/audioparamdescriptor/index.html index 5eef33af9791a57..98f9232c4dbf7a1 100644 --- a/files/en-us/web/api/audioparamdescriptor/index.html +++ b/files/en-us/web/api/audioparamdescriptor/index.html @@ -13,7 +13,7 @@ ---
{{APIRef("Web Audio API")}}
-

The AudioParamDescriptor dictionary of the Web Audio API specifies properties for an {{domxref("AudioParam")}} objects. It is used to create custom AudioParams on an {{domxref("AudioWorkletNode")}}. If the underlying {{domxref("AudioWorkletProcessor")}} has a {{domxref("AudioWorkletProcessor.parameterDescriptors", "parameterDescriptors")}} static getter, then the returned array of objects based on this dictionary is used internally by AudioWorkletNode constructor to populate its {{domxref("AudioWorkletNode.parameters", "parameters")}} property accordingly. +

The AudioParamDescriptor dictionary of the Web Audio API specifies properties for {{domxref("AudioParam")}} objects. It is used to create custom AudioParams on an {{domxref("AudioWorkletNode")}}. If the underlying {{domxref("AudioWorkletProcessor")}} has a {{domxref("AudioWorkletProcessor.parameterDescriptors", "parameterDescriptors")}} static getter, then the returned array of objects based on this dictionary is used internally by AudioWorkletNode constructor to populate its {{domxref("AudioWorkletNode.parameters", "parameters")}} property accordingly.

Properties

@@ -32,7 +32,24 @@

Examples

-{{page("/en-US/docs/Web/API/AudioWorkletNode/parameters", "Examples")}} +

The code fragment below shows a descriptor of this type being returned by a static {{domxref("AudioWorkletProcessor.parameterDescriptors", "parameterDescriptors")}} method defined in a custom AudioWorkletProcessor (this is part of the more complete example in AudioWorkletNode.parameters).

+ +
// white-noise-processor.js
+class WhiteNoiseProcessor extends AudioWorkletProcessor {
+  static get parameterDescriptors () {
+    return [{
+      name: 'customGain',
+      defaultValue: 1,
+      minValue: 0,
+      maxValue: 1,
+      automationRate: 'a-rate'
+    }]
+  }
+
+...
+}
+ +

Specifications

@@ -54,3 +71,10 @@

Specifications

Browser compatibility

{{Compat("api.AudioParamDescriptor")}}

+ +

See also

+ + diff --git a/files/en-us/web/api/audioworkletprocessor/parameterdescriptors/index.html b/files/en-us/web/api/audioworkletprocessor/parameterdescriptors/index.html index 4cfd71d8ca24511..196496334beedc3 100644 --- a/files/en-us/web/api/audioworkletprocessor/parameterdescriptors/index.html +++ b/files/en-us/web/api/audioworkletprocessor/parameterdescriptors/index.html @@ -32,8 +32,20 @@

Syntax

Value

An iterable of {{domxref("AudioParamDescriptor")}}-based objects. The properties of - these objects are as follows: {{page("/en-US/docs/Web/API/AudioParamDescriptor", - "Properties")}}

+ these objects are as follows:

+ +
+
name
+
The {{domxref("DOMString")}} which represents the name of the AudioParam. Under this name the AudioParam will be available in the {{domxref("AudioWorkletNode.parameters", "parameters")}} property of the node, and under this name the {{domxref("AudioWorkletProcessor.process")}} method will acquire the calculated values of this AudioParam.
+
automationRate {{optional_inline}}
+
Either "a-rate", or "k-rate" string which represents an automation rate of this AudioParam. Defaults to "a-rate".
+
minValue {{optional_inline}}
+
A float which represents minimum value of the AudioParam. Defaults to -3.4028235e38.
+
maxValue {{optional_inline}}
+
A float which represents maximum value of the AudioParam. Defaults to 3.4028235e38.
+
defaultValue {{optional_inline}}
+
A float which represents initial value of the AudioParam. Defaults to 0.
+

Examples