W3C home > Mailing lists > Public > public-audio@w3.org > April to June 2012

Re: About input/output channel counts

From: Marcus Geelnard <mage@opera.com>
Date: Tue, 19 Jun 2012 10:34:13 +0200
To: "Chris Rogers" <crogers@google.com>
Cc: public-audio@w3.org
Message-ID: <op.wf453bzsm77heq@mage-desktop>
Den 2012-06-19 00:16:10 skrev Chris Rogers <crogers@google.com>:

> On Mon, Jun 18, 2012 at 12:41 AM, Marcus Geelnard <mage@opera.com> wrote:
>
>> After reading the specification a few times, I'm still confused about  
>> how
>> the number of input/output channels of each AudioNode is  
>> controlled/decided.
>>

[snip]

>> .....
>>
>>
>> So, I guess that this boils down to two question:
>>
>> - What controls the number of input channels of an AudioNode?
>>
>> - What controls the number of output channels of an AudioNode?
>
>
> Hi Marcus, sorry for the confusion.  I'll definitely add all the details
> for each node into the spec.
>
> In the meantime, here's a quick summary of how the different nodes deal
> with channels.  Although at first glance it might seem arbitrary,  
> there's a
> good amount of thought put into why each node type behaves as it does.   
> It
> allows connections between nodes in sensible ways so that, for the most
> part, developers don't need to worry about the channel details.

I agree that this is a good strategy. You should just have to connect  
nodes to each other, and get the most reasonable result out of it.

> AudioBufferSourceNode
>    outputs the number of channels of the buffer that it plays (its  
> .buffer
> attribute)
>
> MediaElementAudioSourceNode
>     outputs the number of channels of the <audio> or <video> element it
> represents
>
> OscillatorNode
>     always outputs one channel (mono)
>
> JavaScriptAudioNode
>     Has input and output number of channels configured on creation.
>
>
> AudioGainNode
> DelayNode
> BiquadFilterNode
> WaveShaperNode
>     These nodes all propagate the number of channels of the input to the
> output.
>     The number of channels of the input is the largest number of channels
> of any of its connections.
>     So, for example, if the input has both a 1-channel and 2-channel
> connection, then it will be 2.
>
> AudioPannerNode
> ConvolverNode
> DynamicsCompressorNode
>     These have 2-channel output.
>
> AudioChannelSplitter
>     The number of channels of the input is the largest number of channels
> of any of its connections.
>     Each of the outputs are 1-channel.
>
> AudioChannelMerger
>     The number of channels of each input is the largest number of  
> channels
> of all connections to that input.
>     The number of channels of the output is the sum total number of
> channels of all inputs.


Thanks Chris, that cleared things up a bit for me :)

I guess what had me most confused was the ConvolverNode, until I found the  
text "the playback system has M output channels" in the Reverb Effect  
section [1] (so really, it's not 2-channel output, but whatever the  
numberOfChannels is set to in the AudioDestinationNode?).

A few comments about the nodes that have special channel configurations:

- Regarding the ConvolverNode, see Bug 17542. Suggestion: set number of  
output channels manually.

- Regarding the JavaScriptAudioNode, see Bug 17534. I think it would be  
good to support the propagate-input-to-output paradigm (e.g. as for  
AudioGainNode) for JavaScriptAudioNodes too.

- I don't really see why the DynamicsCompressorNode only supports  
2-channel output (it's not mentioned in the spec anywhere, btw). You  
should be able to down-mix the input to mono for the envelope analysis  
part, but apply the dynamic gain to all channels just as for the  
AudioGainNode, right?

- I'm still trying to get a grip on AudioPannerNode (will probably have a  
few comments on it later when I've thought it thorugh). It seems to be a  
limitation to only support 2-channel output if you have a 5.1 system, for  
instance (where you should be able to do something even more interesting  
in terms of panning/3D?).


/Marcus

[1]  
https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#Convolution-reverb-effect
Received on Tuesday, 19 June 2012 08:34:51 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 19 June 2012 08:34:51 GMT