Nov 14th 2008 Playing WAVE multichannel audio from a browser

Introduction:

Most programs can create multichannel WAVE audio files, but they fail in creating in such a way that they are actually playable in multichannel. I used Mathematica, Audacity, Matlab, Amadeus Pro, and Ardour, to create the sounds and they sound good when I played them from within the application, but when I exported it and played with Quicktime, all the channels were collapsed in only two. Audacity is especially deceiving because you can change the parameters in the preference panel to let you record multichannel files, and when you export, it actually asks you for the mapping of tracks and channels, however, when you listen to it using quicktime, it doesn’t work.

Explanation:

These programs are saving the file with WAVE PCM format instead of WAVE Extensible format. See the differences here:

http://www.microsoft.com/whdc/device/audio/multichaud.mspx

My Solution:

Generate your files with 6 channels in Audacity (btw, I don’t know if it will work with more channels) and keep in mind the standard distribution of the channels:
1. Front Left – FL
2. Front Right – FR
3. Front Center – FC
4. Low Frequency – LF
5. Back Left – BL
6. Back Right – BR

use mctools to convert them to WAVE Extensible format:

http://people.bath.ac.uk/masrwd/mctools.html

This toolkit works in Windoze and Mac, it comes with an utility called copysfx that does exaclty that:

your_prompt$ ./copysfx -t4 inputFile outputFile

(type only the name of the command for help instructions)

I found useful this tcsh script for batch processing:

foreach f (`ls /the_full_path_directory_where_you_have_your_files/*.wav`)
./copysfx -t4 $f $f.wav
end

Save it as toWAV-EX.tcsh, give it execution permission (chmod -744 toWAV-EX.tcsh) and execute from the mctools directory with tcsh toWAV-EX.tcsh

Your converted files are going to be in the same directory of the originals, and have double ‘wav’ extension. Change the name as you wish.

Voila! Now you can play it from Quicktime and therefore from the browser (I worked with Safari and Firefox). Also, be sure your card is multichannel!!! and for me it worked using JackOS to route the audio, I don’t know if you can achieve similar results without it.

that’s it.

No Comments » Posted by julovi / Bitacora