Slion.net>Dev>SymbianHome>SymbianSoundMixer

Symbian Sound Mixer implementation

Purpose & scope

The other day I had to implement a sound mixer for a game of mine and I spent quite a lot of time trying to find out what kind of audio file format I was suppose to feed the mixer with. So I thought I may as well share my experience here if only as a reference for myself the next time I have to play with audio files on Symbian OS. On this page I provide practical information about wav file format manipulation, playing and mixing sounds on Symbian OS.

Starting point

I based the initial implementation of my mixer on the S60 Platform: Sound Mixer Example v2.0 from Nokia forum. First thing you can do I guess is download it, compile it, run it and debug it. That got me started pretty fast.

Now that example is pretty impressive I have to say, good job Nokia people smile However it took me a while to get it to play my own wav files and figure out exactly what kind of audio file format you have to provide.

Audio File Format

The Nokia example mentioned above comes with three wav files without header. Those header-less files are also called raw audio file. Their format can be describe as:

A side effect of the header-less wav file is that you won't be able to play it on your average desktop media player. I find it rather unpractical.

The Symbian API used to play the sound is CMdaAudioOutputStream::WriteL. Now my understanding is that one can feed that function with 8 Bits PCM Uncompressed data of various channels (mono or stereo) and sample rates (in Hz). However in our example the channel is hard coded to Mono and the sample rate to 16000Hz. In fact since the wav files we are talking about were stripped off their header the application can't determined those value so it has to be hard coded somehow.

It took me some times to figure out the expected format for those wav files. Then I was able to convert my own audio files from whatever other wav format to the correct one using the free version of Switch. However you will still obtain a wav file with header. To remove the header you can always use SOX by running a command like sox inputSound.wav outputSound.raw . Note the raw extension for the output file which is actually telling SOX to remove the header. Then your file should be ready to be played by the Nokia example has is.

However I find it easier to modify the wav loader in the mixer to leave out the 44 Bits of the wav header rather than expecting raw files. It's also more convenient to be able to play your sound files on your desktop or use the exact same sound file for running your application on other platform. It's much easier if like me you are writing portable OpenGL applications.

Export using Audacity

I used Audacity 1.3.6 (beta).

References