We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

Web Audio API 的 AudioBuffer 构造函数将创建一个新的 AudioBuffer 对象.

语法

var audioBuffer = new AudioBuffer([options]);
var audioBuffer = new AudioBuffer(context[, options]);

参数

继承参数自 AudioNodeOptions 字典.

context 
一个 AudioContext 对象. (这个参数已经被标准移除, 详细信息请参阅浏览器兼容性部分.)
options 可选
Options are as follows:
  • length: buffer中采样帧的长度.
  • numberOfChannels: buffer的通道数. 默认值为1. 
  • sampleRate: buffer的采样率 (Hz). 默认值为构造此对象时使用的 context 的采样率.

返回值

一个新的 AudioBuffer 对象实例.

规范

Specification Status Comment
Web Audio API
AudioBuffer
Working Draft Initial definition.

浏览器兼容性

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support551 ?53 No422 ?
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support551551 ?53422 ?6.0

1. The context parameter was supported up until version 57, but has now been removed.

2. The context parameter was supported up until version 44, but has now been removed.

文档标签和贡献者

此页面的贡献者: WhiteMind
最后编辑者: WhiteMind,