playN, Ndef, multiple channels

Hi all -
I’m currently trying to take 8 channels from one Ndef and input them to another Ndef. Here is the simplest I could write the code:

s.options.numOutputBusChannels=8;
s.reboot;
s.meter;
~oct = Bus.audio(s, 8);
~node1 = Ndef(\k, {SinOsc.ar(400!8, 0, 0.1)}).play;
~node1.playN(~oct);
~node2 = Ndef(\l, {In.ar(~oct, 8)}).play;

As you will see, the audio only comes out of a single channel on the second node…
Can anyone here help me understand what I’m doing wrong?
Thank you, in advance

you can reference one Ndef from another and get the output like this

~node2 = Ndef(\l, { Ndef(\k).ar }).play;

In this particular case, I need to pass some things through a bus for the sake of consistency with a larger amount of code. I know it’s not the standard practice, but is it completely off-the-table?

Visiting the playN helpfile, I tried to add:

p = ProxySpace.push;

But this created even more erratic results.

Having said that, using .play, as opposed to playN seems to work. I’m assuming this is because the channels are non-adjacent.

When using NodeProxies, you don’t have to use Busses for routing anymore :slight_smile:
There are two popular ways (of many!) for using NodeProxies, I demonstrated them below


// you enter a ProxySpace with:
// every ~ variable is now a NodeProxy
p = ProxySpace(s).push

~node1 = {SinOsc.ar(400!8, mul: 0.1)}
~node2 = {~node1.ar[(0..3)] * LFNoise1.kr(1)} // channels 0 through 3
~node2 = {~node1.ar[[0,1]] * LFNoise1.kr(1)} // channels 1 and 2
~node2 = {~node1.ar[[1,6]] * LFNoise1.kr(1)} // channels 1 and 2
~node2.play
~node2.stop

// and you leave it with:
p.pop


// When using Ndefs, the Ndef class holds a proxyspace where the NodeProxies are stored:
Ndef(\node1, {SinOsc.ar(400!8, mul: 0.1)})
Ndef(\node2, {Ndef(\node1).ar[(0..3)] * LFNoise1.kr(0.5)}) // 0 through 3
Ndef(\node2, {Ndef(\node1).ar[[1,2]] * LFNoise1.kr(0.5)})  // 1 and 2
Ndef(\node2, {Ndef(\node1).ar[[3,4,7]] * LFNoise1.kr(0.5)}) // 3,4,7
Ndef(\node2).play
Ndef(\node2).stop

Hope this helps!

1 Like