# Is it possible for Out.ar to output to non-contiguous outputs

quickly and maybe offensively: Max and Pd [dac~] can take non-contiguous outputs, which is very convenient for reassigning them as part of delivery of a piece for various soundcards and setups. I might want to use move my usual [dac~ 1 2 3 4 5 6] to [dac~ 11 12 13 1 15 16] for instance. the 1 in the middle is not a typo.

I was thinking of making an array for my outs but then I’m stuck as it seems I can’t pass an array to the bus out. What would be the most elegant way to achieve what I am trying to do in SC?

thanks.

You can do something like this:

s.options.numOutputBusChannels_(8)

SynthDef(\test, {|outs = #[0,1,2,3]|
var testSig = SinOsc.ar(110) * 0.1;
outs.collect{|n|Out.ar(n, testSig)}

Synth(\test); // watch the meter
Synth(\test).free;
Synth(\test, [\outs, [2, 4, 5, 7]]) // watch the meter


Thanks for this. It would probably not work for me as I am creating a sum of many files and processes in my performance code which I send to a 5.1 bus (L-R-C-x-Ls-Rs) and that bus is the thing I need to rejig.

Here is some code trying to do it around your idea. There might be a more efficient way but that works so thanks!

s.options.numOutputBusChannels_(8)
s.reboot

SynthDef(\test, {arg outs = #[0,1,2,3,4,5];
var input = SinOsc.ar(110,mul: ((0..5) * -10).dbamp);
outs.collect{|j, i| Out.ar(j,input[i])};

x = Synth(\test); // watch the meter - the amplitude helps to see what is where
x.free;

// another order
x = Synth(\test, [\outs, [3,2,4,5,1,0]]) // watch the meter



You can do this:

SynthDef(\test, {|outs = #[0,1,2,3,4]|
var surroundMockUp = 5.collect{|i|SinOsc.ar(110 * (i + 1)) * 1/(i+1) * 0.1};
5.collect{|i|Out.ar(outs[i], surroundMockUp[i]) }

Synth(\test); // standard
÷Synth(\test, [\outs, [3,5,1,7,6]]); // new configuration

Well, basically the same thing…

1 Like

You would probably want to use busses rather than doing everything inside the same SynthDef. I have not worked with surround sounds myself. You might wanna take a lot at the Ambisonic Toolkit. Here is solution with standard Ugens I think should work, kind of like a half-normal patch bay.

~surroundbus = 5.collect{Bus.audio(s, 1)}

(
SynthDef(\surroundSig, {|bus = #[0,1,2,3,4]|
var surroundMockUp = 5.collect{|i|SinOsc.ar(110 * (i + 1)) * 1/(i+1) * 0.1};
5.collect{|i|Out.ar(bus[i], surroundMockUp[i])}

SynthDef(\out, {|in = #[0,1,2,3,4], routing = #[0,1,2,3,4]|
routing.collect{|n, i|Out.ar(n, In.ar(in[i]))};