Open Sound System
OSS 4.x Programmer's Guide

Do you have problems with sound/audio application development? Don't panic! Click here for help!

Using multiple channels with OSS

In the one channel mode (mono) the subsequent samples for each channel will simply be stored one after another just like in an array. If there are more channels then method known as inteleaving will be used.

An interleaved sample stream is simply a two dimensional array where the each row contains the samples for all chennels for the given moment of time (sample period). Samples are usually handled using one dimensional arrays.

Multi channel audio formats such as 5.1 and 7.1

There are some commonly used speaker configurations that have been given names like 2.0, 3.1, 5.1, 7.1 and so on. However it's also possible that the channels of a multi channel audio stream don't follow any of these channel schemes. They may be for example just a set of independent channels that are grouped together for some technical reasons.

Even with the common formats such as 5.1 there are several ways to bind the channels to the "slots" of the interleaved audio stream. For this reason there is the SNDCTL_DSP_GET_CHNORDER ioctl call. An application can use it to find out how the output channels are ordered.

Compressed multi channel audio streams such as AC3 and MPEG

There are few bitstream formats that are used to carry multi channel audio streams. However these formats do't use interleaving and nothing described above is valid with them.

These formats have some kind of frame structure. When an application plays them it's necessary to insert some zero bytes between the frames to make the data rate match the sampling rate.

Copyright (C) 4Front Technologies, 2007. All rights reserved.
Back to index OSS web site