Multichannel Expansion Confusion

Hi there -
I am still at a bit of a loss for the proper way of doing this - and I was hoping some of the experts here might be able to help.

I’d like to have a function that can scale for a range of possible output channels.

The most simple version looks like the following.

The issue is that the instances of the control names don’t seem to be controlling independent channels of delay feedback. I am definitely misunderstanding something here and I hope it is transparent to a more seasoned user. Thank you!

~chans = 2;	

~rangeCon = {
		|name, default=0, defaultLow=0, defaultHigh=1|
		var control = [];
		Array.fill(~chans, {|x|
			control = control.add((name++x).asSymbol.kr(default))});
};

~oneDelay = {{|sig|
	var time, panPos, local, feedback, newSig;
	time = ~rangeCon.(\time, 0.1, 0, 10);
	feedback = ~rangeCon.(\feedback, 0.2, 0, 0.999);
	local = LocalIn.ar(~chans);
	local = local+sig;
	newSig =  local.collect{|a, index|
		a = DelayN.ar(a, 10, time[index])*feedback[index];
	};
	LocalOut.ar(newSig);
	newSig;
}};

~a = NodeProxy(s, \audio, ~chans).play;
~a[0] = {Saw.ar(102!~chans)*Saw.ar(0.9)};
~a[1] = \filter-> ~oneDelay.();

Array.fill constructs the array for you, so the .add is not needed. It would be needed if you were writing ~chans.do.

So you’re ending up with an array of arrays.

Better:

~rangeCon = {
		|name, default=0, defaultLow=0, defaultHigh=1|
		Array.fill(~chans, {|x|
			(name++x).asSymbol.kr(default)
		});
};

hjh

1 Like