This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 17396 - (numberOfChannels): AudioDestinationNode.numberOfChannels
Summary: (numberOfChannels): AudioDestinationNode.numberOfChannels
Status: CLOSED WONTFIX
Alias: None
Product: AudioWG
Classification: Unclassified
Component: Web Audio API (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: TBD
Assignee: Chris Rogers
QA Contact: This bug has no owner yet - up for the taking
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-05 12:17 UTC by Michael[tm] Smith
Modified: 2014-10-28 17:16 UTC (History)
6 users (show)

See Also:


Attachments

Description Michael[tm] Smith 2012-06-05 12:17:06 UTC
Audio-ISSUE-33 (numberOfChannels): AudioDestinationNode.numberOfChannels [Web Audio API]

http://www.w3.org/2011/audio/track/issues/33

Raised by: Philip Jägenstedt
On product: Web Audio API

It's not defined what numberOfChannels means, is it a constant value that depends on the underlying hardware or the maximum number of channels of all the inputs?

More importantly, what is the use case for exposing this information?
Comment 1 Olivier Thereaux 2012-06-07 08:17:21 UTC
[admin] Assigning items currently being worked on by editor.
Comment 2 Olivier Thereaux 2012-06-07 14:20:33 UTC
From the Editor: Change Set: https://dvcs.w3.org/hg/audio/rev/90e55985e260

Feedback given in http://lists.w3.org/Archives/Public/public-audio/2012AprJun/0430.html
«
As Marcus pointed out in <http://lists.w3.org/Archives/Public/public-audio/2012AprJun/0355.html>, maxNumberOfChannels doesn't seem to really work and an array of values would make more sense.

We don't think that setting numberOfChannels to a configuration that isn't supported should throw an exception, since that's likely to result in unhandled exceptions when authors have only tested with one speaker configuration. For example, it's to be expected that authors will set numberOfChannels to 2 without checking maxNumberOfChannels, which will fail on smartphones with a single speaker. Instead, we think that the requested number of channels should be used and mixing should be applied if the hardware doesn't support it.

Note also the typo in "If this value is 0, then this indicates that <code>maxNumberOfChannels</code>" which should be numberOfChannels.
»
Comment 3 Olivier Thereaux 2012-10-24 09:03:39 UTC
(In reply to comment #2)
> As Marcus pointed out in
> <http://lists.w3.org/Archives/Public/public-audio/2012AprJun/0355.html>,
> maxNumberOfChannels doesn't seem to really work and an array of values would
> make more sense.

Would the proposed resolution of Bug #17379 resolve this as well?
https://www.w3.org/Bugs/Public/show_bug.cgi?id=17379#c2
Comment 4 Wei James 2012-10-24 10:20:56 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > As Marcus pointed out in
> > <http://lists.w3.org/Archives/Public/public-audio/2012AprJun/0355.html>,
> > maxNumberOfChannels doesn't seem to really work and an array of values would
> > make more sense.
> 
> Would the proposed resolution of Bug #17379 resolve this as well?
> https://www.w3.org/Bugs/Public/show_bug.cgi?id=17379#c2

the proposal in Bug #17379 seems only resolve the naming issue of channel layout. 
there are still two issues here:
1. using maxNumberOfChannel or using an array of layout. I think current spec using maxNumberOfChannel is reasonable. 

2. Exception handling. (automatic down/up mixing or throw exception?). I prefer to automatic mixing.
Comment 5 Marcus Geelnard (Opera) 2012-10-24 14:32:12 UTC
(In reply to comment #4)
> 1. using maxNumberOfChannel or using an array of layout. I think current
> spec using maxNumberOfChannel is reasonable.

As long as the specification is clearer about what should happen when setting numberOfChannels to an unsupported number of channels. For instance: if the supported channel counts are 2 and 6, then maxNumberOfChannels should return 6, but what must happen if you set numberOfChannels to 1, 3, 4 or 5?

And I still believe that there must be a better way to signal "read only" than to have '0' as a magic constant. In fact, "read only" only means that there is a single allowed configuration (e.g. 2 for a stereo only context).

> 2. Exception handling. (automatic down/up mixing or throw exception?). I
> prefer to automatic mixing.

Dito.
Comment 6 Ralph Giles 2013-01-16 01:01:01 UTC
I'm also really unclear on this. The current draft includes some downmix matricies, but doesn't say when they are to be used.

Mapping to a smaller number of output channels inside an AudioDestinationNode is the only obvious place I see, but this is difficult to apply consistently since surround playback is often supported on systems without multichannel playback hardware, with the OS doing its own downmixing. In other words, when "downmixing should be supported" which software layer should be doing the supporting?

If setting numberOfChannels asks AudioDestinationNode to up/down mix to a particular number of output channels (ignoring what the lower layers might do with this) how do we set it pass-through?

Should maxNumberOfChannels change in response to configuration changes?
Comment 7 Chris Rogers 2013-01-16 01:11:57 UTC
(In reply to comment #6)
> I'm also really unclear on this. The current draft includes some downmix
> matricies, but doesn't say when they are to be used.
> 
> Mapping to a smaller number of output channels inside an
> AudioDestinationNode is the only obvious place I see, but this is difficult
> to apply consistently since surround playback is often supported on systems
> without multichannel playback hardware, with the OS doing its own
> downmixing. In other words, when "downmixing should be supported" which
> software layer should be doing the supporting?
> 
> If setting numberOfChannels asks AudioDestinationNode to up/down mix to a
> particular number of output channels (ignoring what the lower layers might
> do with this) how do we set it pass-through?
> 
> Should maxNumberOfChannels change in response to configuration changes?

(for what it's worth this hasn't yet been implemented in WebKit)

Robert and I have been discussing this but don't have all the answers yet.  Robert suggests that the up/down mixing would be a property of each node, which could make sense.  We've also discussed the idea of a way to query the AudioContext for the hardware channel layout, in addition to just the raw number of channels (.maxNumberOfChannels).  Then we would allow the JS code to configure the up/down mixing behavior as it wishes, perhaps using the hardware channel layout information.  Robert, can jump in if I've misunderstood.
Comment 8 Olivier Thereaux 2014-10-28 17:14:05 UTC
Web Audio API issues have been migrated to Github. 
See https://github.com/WebAudio/web-audio-api/issues
Comment 9 Olivier Thereaux 2014-10-28 17:16:58 UTC
Closing. See https://github.com/WebAudio/web-audio-api/issues for up to date list of issues for the Web Audio API.