View Full Version : [OpenAL] Multi- to Single Channel

19-10-2007, 08:40 PM
Hi everyone :)

I'm trying to implement some kind of basic sound module, based on OpenAL. I read that OpenAL can only use mono-sounds for 3D sound. So i like to know whether it's possible to let OpenAL convert or treat a multichannel sound, in such a way, that it can be used for 3d-playback.

Just wondering if there is another way than converting the sounds one by one to mono. :?


21-10-2007, 01:35 AM
Well you know the reason why multichannel is not practical for 3D sound right? :)

Just in case you or others don't: Left and Right channel... think about how that works in 3D? Where is your right and where is your left in a 3D space. :)

Considering that though, I can't think of a reason why you couldn't mix the stereo samples into a mono channel in real time. Mind you, would you really want to considering that it's just going to waste cpu juice that could be better used to mix the 3D sound instead?

If you are able to use streams or raw allocated memory with AL playback then you could pre-mix your stereo wave files at the time they are loaded and store them as a single channel sample. Actually this method would probably reduce the amount of memory required to have stored the original sound data by half.

:?: Does anyone know of a tutorial/instructions on how to mix 2 audio channels without hardware or some other damn library? :?:

I used to have a page that had this info before, but I can't find the link. I can't believe this kind of programming is so hard to find these days! :?

21-10-2007, 01:44 AM
Ah found it! I'm such a dumby. :P


21-10-2007, 09:59 AM
Thanx will :)

I think writing a channel mixer for WAV might be more work then most people think.
Look at this page: http://en.wikipedia.org/wiki/Audio_file_format

Near the bottom it says:

standard audio file format used mainly in Windows PCs. Commonly used for storing uncompressed (PCM), CD-quality sound files, which means that they can be large in size around 10 MB per minute of music. It is less well known that wave files can also be encoded with a variety of codecs to reduce the file size (for example the GSM or mp3 codecs). Wav files use a RIFF structure.

So when i write my own WAV importer and mixer, it cannot deal with the compressed formats.
I guess that the aLutLoadWAVFile function CAN handle most (or ALL) of the WAV format's, so why should i replace it with a routine that probably can't do that. So i guess making my samples mono with some Audio-software is the best option.