大网数据广告活动
Web 标准与前端开发

AudioParamDescriptor

· 52CE 我爱测

The **`AudioParamDescriptor`** dictionary of the Web Audio API specifies properties for an AudioParam objects. It is used to create custom `AudioParam`s on an AudioWorkletNode. If the underlying AudioWorkletProcessor has a AudioWorkletProcessor.parameterDescriptors static getter,

Web Audio API

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

属性

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

示例

下面的代码片段展示了自定义的 AudioWorkletProcessor 中的静态方法 AudioWorkletProcessor.parameterDescriptors 返回该类型的描述符(这是 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",
      },
    ];
  }

  // …
}

规范

浏览器兼容性

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。