Surround mixing and playback of multichannel audio

Subscribe to RSS news feed

Mono stream is usually enough for voice. Stereo for music. But for cinema industry two channels was never enough. Starting as early as at 1940 they were always trying to enrich the sound of movies by recording additional audio channels.

When DVDs came to personal computers, it was just a matter of time when sound card manufacturers introduce multichannel support. And it is oblivious that surround sound is not limited to movies. Games and other applications can benefit from multichannel audio as well.

More about surround sound:

Multichannel audio support in Windows

The format of mono or stereo audio stream can be defined as WAVEFORMATEX structure. It was designed for stereo-speaker configurations only, as it does not include any information about channel mapping. First channel is always mapped to the left speaker, and second to the right one.

When there are 3 or more channels and speakers, mapping is not that oblivious. Should 3rd channel be rendered through the Back Left speaker or through subwoofer? The mapping should be specified and documented somehow, so Microsoft introduce the WAVEFORMATEXTENSIBLE structure.

New dwChannelMask field allows developers to explicitly specify a set of speakers for multichannel audio stream. In addition new structure deals with ambiguity caused by streams with non byte aligned samples (such as 20-bit samples), by introducing a new wValidBitsPerSample field.

More about multiple channel audio in Windows:
Multiple Channel Audio Data and WAVE Files

Multichannel surround mixing sample

We have extended our components to support multichannel streams. New pcm_channelMask property was added to specify a set of speakers audio channels should be played back at.

In the vcSurroundDemo sample it is possible to choose any default or custom configuration of speakers.

There could be any number of audio sources and each source could be mapped to any set of speakers. First, choose the type of source: live recording, WAV file or sine. Press [Add to List] to add the source to the list of available sources. Next, check the speakers, this source must be mapped to:

Press [Done] to close source selection form.

At the main form current mapping could be shown starting from the list of speakers (with assigned sources as sub-nodes) or from the list of sources (with assigned speakers as sub-nodes).

When ready, press the [Open] button to start playback.

Sample Limitations

Not all sound card drivers support multichannel audio playback. Check for the latest drivers if sample is not working properly.

Some drivers (for example, included with SoundBlaster 5.1 Live!) may perform own surround panning, in addition to specified mapping.

.WAV files, used as sources must have mono streams with the same sampling rate as specified on the main form.


Precompiled binary of this sample is included in the Demos package.