Demux is a little utility I wrote to demultiplex soundfiles with arbitrarily large numbers of channels. It runs in a Terminal window, so it's good for Mac OS and Linux. (Experienced coders could probably figure out how to run it on Windows too.) You can download demux here. Demux was inspired by the 32 channel limit on the otherwise excellent DiskIn, a unit generator of SuperCollider.
Demux relies on the wonderful libsndfile by Erik de Castro Lopo.
Once libsndfile is installed on your machine, you can compile demux by typing the following invocation into a Terminal window, after navigating to the directory that contains "demux.c".
cc -o demux demux.c -lsndfile
Now you have an executable file called "demux". You can move it to wherever you store your
binaries. Demux has three arguments: an input file (containing any number of channels),
the intended output file (which will be mono) and the channel number to extract. To
extract the 86th channel of a soundfile called "gorgon.aiff" type the following:
demux gorgon.aiff gorgon_ch86.aiff 85
Demux counts channels starting at 0, so 85 is actually the 86th channel. Be careful not
to get your input and output names mixed up, or you might accidentally write over your
original file! The extracted mono file will be in the same format (same sample rate, bit width,
and file format) as the source file.
Once a multichannel file has been demultiplexed to mono files, DiskIn can stream all the channels off the disk, assigning one synth to each mono file. Et voila: streaming soundfile playback of an arbitrary number of channels in SuperCollider.
Demux is intended to serve as a stopgap until
DiskIn or some other Ugen is written to stream multichannel soundfiles without
hard-coded channel limits. For now, it solved my multichannel problem - maybe it can
solve yours too!
Demux is dedicated to the superb
CAF developed by
Apple.
June 25, 2012.
p.s. A note of thanks to members of the SuperCollider community for quickly informing me of
SuperCollider's current limits regarding multichannel soundfile playback. The conversation that
motivated this code may be read
here.