One of the most difficult issues in multichannel handling the channel order. As weird as it sounds, there is no standard for channel order and everyone basically uses what they wish. After looking through a lot of options I've come to the conclusion that we should definitely be using the channel order described in Microsoft documentation combined with a channel mask. As the Microsoft website already says "Several external standards define parts of the following master channel layout". The motivation is further explained below.
First let's take a look at most common multichannel audio formats and their 5.1 channel assignments (FL=front left, FR=front right, FC=front center, LFE=low frequency effects, SL=surround/back left, SR=surround/back right):
- WAV/MP3/FLAC: FL, FR, FC, LFE, SL, SR
- DTS/AAC: FC, FL, FR, SL, SR, LFE
- AC3/Vorbis: FL, FC, FR, SL, SR, LFE
- AIFF: FL, SL, FC, FR, SR, LFE
Then we need to have a look at known audio systems, their corresponding default channel assignments for 5.1 channel audio are as follows:
- ALSA: FL, FR, SL, SR, FC, LFE
- OSS4: FL, FR, FC, LFE, SL, SR
- MacOSX: FL, FR, FC, LFE, SL, SR
- Win32: FL, FR, FC, LFE, SL, SR
If we compare the two lists, audio format channel order and audio output channel order, it is quite easy to notice that the suggested channel order has most similarities in both and we can do out without channel masking. It should be noticed though that this is only true with 5.1 audio, if we want to include the mentioned 4.0 audio we need to have a support for channel mask. That means that some channels can be masked out of the audio stream and therefore ignored.
I hope this is good enough introduction to multichannel audio, I will get back to it later when I will introduce how it will affect the converter and what should be done there.