Should we add a set Channel number API for Web Audio spec?

Hi

	I am working on adding multi-channel support for webaudio. When I come across the destination node, I realized that it is not easy for the audio destination node to choose the right channel number automatically.

	1. you can hardly figure out the hardware support for channels numbers. On Linux, you can tweak the alsa config file to fake some channels support either for downmix or upmix.( maybe I am wrong on this? Please correct me) And even if you can figure out the real channel support of the hardware soundcard. Still have the issue 2:

	2. not like <audio> tag, webaudio support up/down mix, take 5.1 sound card for example, if you can find out the hardware capability of the sound card and automatically set it to 5.1 channels. Then since most of the source format is stereo, you will facing the issue that you need to upmix it to 5.1 inside webaudio, but you don't actually need to, since alsa can handle it, if the user really want to upmix 2.0 to 5.1. Then If alsa told you it support 5.1 but actually it doing it by downmix 5.1 to stereo, you are doing 2.0 ---- ( by webaudio) ---> 5.1 ---- (by Alsa) ---> 2.0, too bad...

	3. setting the channels number on the fly according to source? Seems rather difficult if not impossible ( at least for alsa when a stream is already started. You can't do that.)

	So, I am wondering, should we add a interface like context.setChannels? if the hardware don't support the channel layout, return the revised value. And the application probably know better on what kind of audio source they want to play.

	And also a lot of webaudio node might benefit from knowing the target channels number, so that they can run more efficiently.

	Any Ideas? Thanks.

Best Regards,
Raymond Liu

Received on Wednesday, 14 March 2012 07:39:29 UTC