Multichannel: Best Practices

Hi -

I’m in a situation with an unpredictable multichannel audio interface. Every time I plug it in, channels 1-8 seem to come out of different ports. I’d like to do is create some code where I can calibrate my own audio outputs at the outset.

Let’s say the order of the speakers works out to be something like [4, 7, 6, 3, 5, 1, 2, 0].
I could output to the hardware buses in that order, but if I’m dealing with stereo audio files, they are going to continue to play on adjacent buses.

I’d like to know if others have solutions for establishing a fixed order at the outset of their work.

How about this… you could write the signals first to internal buses (with consecutive bus numbers for stereo, as you noted). Then, at the end of the node tree, use one or more synths to read the internal buses and re-order them to the hardware outputs.

Basically an abstraction layer: The musical code shouldn’t have to worry about the speaker arrangement. (If it does, you’re setting yourself up for headaches.)

hjh

1 Like

currently, I write a 16 channel piece and have stereo on my laptop. I use this:

~projectNumChannels = 16;
~projectNumOutputChannels = 2;
s.tree = {
	{
		var allChannels = In.ar(0, ~projectNumChannels);
		var outputChannels = allChannels;

		if(~projectNumOutputChannels != ~projectNumChannels) {
			//outputChannels = SplayAz.ar(~projectNumOutputChannels, allChannels)
			outputChannels = allChannels.clump(~projectNumOutputChannels).sum;
		};

		ReplaceOut.ar(0, outputChannels.dump);
	}.play(addAction: \addAfter);

	"\n: Server routes % channels to % output channels.\n"
	.format(~projectNumChannels, ~projectNumOutputChannels).postln;
};

And when using 16 speakers, I just set ~projectNumOutputChannels = 16;

P.S. [edit] : I’ve added one line: ReplaceOut.ar(0, outputChannels.dump); this really makes sure that the input channels are not added to the existing ones.

4 Likes

In the past, I’ve used the MacOS say command to generate audio files saying the name of each speaker in a complex configuration (e.g. “left front” or “three”), and then made a simple Synth to play these out to the appropriate speakers. …And then annoyed people by playing this in a loop until I get the speakers routed correctly :slight_smile:

Julians solution - of a synth that does the rerouting at the end of your graph - is a good one.

3 Likes