OfflineAudioContext - 为多个频道添加收益

时间:2018-01-31 18:38:31

标签: webkitaudiocontext

我试图在OfflineAudioText中操纵各个缓冲区的增益。

交流和数据先前在

中加载后确定
 var source = ac.createBufferSource();
 source.buffer = data;
 var splitter = ac.createChannelSplitter(2);
 source.connect(splitter);
 var merger = ac.createChannelMerger(2);

 var gainNode = ac.createGain();
 gainNode.gain.value = 0.5;

 splitter.connect(gainNode, 0);
 splitter.connect(gainNode, 1);
 gainNode.connect(merger, 0, 1);
//error occurs here
 gainNode.connect(merger, 1, 0);

 var dest = ac.createMediaStreamDestination();
 merger.connect(dest);

错误:无法执行' connect' on' AudioNode&#39 ;:输出索引(1)超过输出数量(1)

1 个答案:

答案 0 :(得分:0)

我没有正确分配输入:

splitter.connect(gainNode,0); splitter.connect(gainNode,1);

gainNode.connect(merger,0,0); gainNode.connect(merger,0,1);