Route a specific bus of a multichannel bus to a specific synth


#1

I’m trying to create a multichannel setup where I have a 8-channel bus and 8 indipendent “output stage” synths I want to control separately.

When I create these synths I’m unable to assign a specific bus (from the multichannel one) as input of a specific synth.

here’s the code which is giving me an error:

(
s.waitForBoot({
	
	SynthDef(\my_outputstagesynth, {
		|in=0, out=0|
		var sig = In.ar(in, 1);
		Out.ar(out, sig*0.4);
	}).add;
	
	s.sync;

	~multichannel_bus = Bus.audio(s, 8);

	~outputstage_array_of_synths = Array.fill(8, {
		arg i;
		Synth(\my_outputstagesynth,	[
				\in, ~multichannel_bus[i], // ERROR
				\out, i
			]);
	});
});
)

while this code doesn’t give me any error (even if I don’t think it’s what I’m looking for):

(
s.waitForBoot({
	
	SynthDef(\my_outputstagesynth, {
		|in=0, out=0|
		var sig = In.ar(in, 1);
		Out.ar(out, sig*0.4);
	}).add;
	
	s.sync;

	~multichannel_bus = Bus.audio(s, 8);

	~outputstage_array_of_synths = Array.fill(8, {
		arg i;
		Synth(\my_outputstagesynth,	[
				\in, ~multichannel_bus,
				\out, i
			]);
	});
});
)

How can I make this kind of routing?

As an option I should create an array of 8 single channel busses but I would prefer to have the multichannel one in order to use it inside future synths where I will implement a VBAP, PanAz panning system.

thank you very much for your support!


#2

I think I’ve found what I was looking for. The Bus's subBus method!
So the working code should be:

(
s.waitForBoot({
	
	SynthDef(\my_outputstagesynth, {
		|in=0, out=0|
		var sig = In.ar(in, 1);
		Out.ar(out, sig*0.4);
	}).add;
	
	s.sync;

	~multichannel_bus = Bus.audio(s, 8);

	~outputstage_array_of_synths = Array.fill(8, {
		arg i;
		Synth(\my_outputstagesynth,	[
				\in, ~multichannel_bus.subBus(i, 1);
				\out, i
			]);
	});
});
)