小编Ale*_*son的帖子

Web 音频上下文和缓冲区的最大输出数量是多少

我正在尝试创建一个程序,它可以将音频输出到单个缓冲区中任意数量的任意通道。我在 Mac 上使用 Chrome 43.0.2339.0 canary(64 位)。我输出的硬件是 Motu 16A,它能够通过 Thunderbolt 连接实现 128 个 IO 通道。我创建了一支笔(基于修改后的 MDN 示例),它演示了我想要完成的任务:http://codepen.io/alexanderson1993/pen/dPwqPL

和代码:

var audioCtx = new (window.AudioContext || window.webkitAudioContext)();
var button = document.querySelector('button');

audioCtx.destination.channelCount = 8

var channels = audioCtx.destination.channelCount;
// Create an empty half-second buffer at the
// sample rate of the AudioContext
var frameCount = audioCtx.sampleRate * 0.5;
button.onclick = function(){
var myArrayBuffer = audioCtx.createBuffer(audioCtx.destination.channelCount, frameCount, audioCtx.sampleRate);

  // Fill the buffer with white noise;
  //just random values between -1.0 and 1.0 …
Run Code Online (Sandbox Code Playgroud)

javascript audio html5-audio web-audio-api

5
推荐指数
1
解决办法
2652
查看次数

标签 统计

audio ×1

html5-audio ×1

javascript ×1

web-audio-api ×1