网络音频:右声道没有声音

Squ*_*eet 5 javascript html5 web-audio-api

我正在尝试使用Web Audio API创建自定义平移控件,但我无法使用通道拆分器和合并节点从正确的通道中获取任何声音:

var context = new webkitAudioContext(),
    destination = context.destination,
    osc = context.createOscillator(),
    gainL = context.createGainNode(),
    gainR = context.createGainNode(),
    splitter = context.createChannelSplitter(2),
    merger = context.createChannelMerger(2);

osc.frequency.value = 500;

osc.connect(splitter);

splitter.connect(gainL, 0);
splitter.connect(gainR, 1);

gainL.connect(merger, 0, 0);
gainR.connect(merger, 0, 1);

osc.noteOn(0);

gainL.gain.value = 0.1;
gainR.gain.value = 0.5;

osc.noteOff(2);

merger.connect(destination);
Run Code Online (Sandbox Code Playgroud)

我错过了一些明显的东西吗?这里有上面代码的JSBin预览:http://jsbin.com/ayijoy/1/

我正在运行Chrome v24.0.1312.57,以防万一.

Osk*_*son 2

我最好的猜测是,发生这种情况是因为振荡器输出单声道信号。尝试使用立体声源,您可能会更幸运。

编辑:以下是如何平移“单声道”信号(绕过分离器,因为没有立体声信号要分离,并将振荡器直接连接到两个增益。然后在调整增益后将两个单声道信号连接到合并器每个频道)http://jsbin.com/ayijoy/16/