Web audio: no sound in the right channel

I am trying to create a custom pan control using the web audio API, but I cannot get sound from the right channel using the channel separator and merge nodes:

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);

Did I miss something obvious here? Here is an example of the JSBin code above: http://jsbin.com/ayijoy/1/

I am using Chrome v24.0.1312.57, just in case.

+5
source share
1 answer

My best guess is that the oscillator outputs a mono signal. Try using a stereo source and you are probably more fortunate.

: , "" ( , , . ) http://jsbin.com/ayijoy/16/

+2

All Articles