currently, I write a 16 channel piece and have stereo on my laptop. I use this:
{
var projectNumChannels = 16;
var projectNumOutputChannels = 2;
var mixDown;
mixDown = {
{
var outputChannels;
var hardwareOutChannels = s.options.numOutputBusChannels;
var from = s.options.firstPrivateBus;
var privateSize = projectNumChannels - hardwareOutChannels;
var allChannels = In.ar(0, hardwareOutChannels).keep(projectNumChannels);
if(projectNumChannels > hardwareOutChannels) { allChannels = allChannels ++ In.ar(from, privateSize) };
outputChannels = allChannels;
if(projectNumOutputChannels != projectNumChannels) {
//outputChannels = SplayAz.ar(projectNumOutputChannels, allChannels)
outputChannels = allChannels.clump(projectNumOutputChannels).sum;
};
"outputChannels size: %".format(outputChannels.size).postln;
outputChannels = outputChannels.extend(projectNumChannels, Silent.ar);
ReplaceOut.ar(0, outputChannels);
}.play(addAction: \addAfter);
"\n: Server routes % channels to % output channels.\n"
.format(projectNumChannels, projectNumOutputChannels).postln;
};
mixDown.value;
s.tree = mixDown;
}.value;
)
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.
P.P.S [edit]: we’ve just noticed: when the projectNumOutputChannels is larger than s.options.numOutputBusChannels, then you may get feedback, because there are the input busses in between. This is why it got a little bit more complicated.
Also, I am using variables instead of environment variables now.