W3C home > Mailing lists > Public > public-audio@w3.org > July to September 2012

Re: Question about channels and merger on destination

From: Alessandro Saccoia <alessandro.saccoia@gmail.com>
Date: Mon, 23 Jul 2012 00:14:55 +0200
Cc: public-audio@w3.org
Message-Id: <F4C2341B-5848-4295-8066-C44E37CE358E@gmail.com>
To: Peter van der Noord <peterdunord@gmail.com>
Peter,
I think this is the intended behavior, according to the docs: "There is a single output whose audio stream has a number of channels equal to the sum of the numbers of channels of all the connected inputs."

You can also check the method checkNumberOfChannelsForInput of AudioChannelMerger.cpp in webkit.
In order to use the merger as a panner for mono sources, I would use two gain nodes before the merger inputs, ad connect or disconnect the oscillators to/from these gain nodes.

var osc = context.createOscillator();
var merger = context.createChannelMerger(2);
var gainL = context.createGainNode();
var gainR = context.createGainNode();
osc.connect(gainL, 0, 0);
gainL.connect(merger, 0, 0);
gainR.connect(merger, 0, 1);
merger.connect(context.destination);
osc.noteOn(0);‚Äč

best
/Alessandro



On Jul 22, 2012, at 10:27 PM, Peter van der Noord wrote:

> Hmmm, when i add another osc to the other intput, they *do* get split up over left and right.
> 
> http://jsfiddle.net/e4b42/
> 
> Is this intended behavior?
> 
> Peter
> 
> 
> Does anyone know why i get stereo sound out of this example?
> http://jsfiddle.net/bJqkm/
> I have a merger with two inputs, connected to the destination, and i assume
> that whatever goes into merger in#0 goes to left, and in#1 goes to right,
> yet the oscillator i connect to an input of the merger sounds in stereo. Am
> i overlooking something?
> Peter
Received on Sunday, 22 July 2012 22:15:27 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 22 July 2012 22:15:27 GMT