NodeProxy through effect bus - newbie confused

Hi all,

apologies if this was answered before, but I couldn’t find the answer.

I’m playing with NodeProxy and patterns and in this setup want to send audio through an effect synth, but placing it correctly in the node tree is giving me pain.

There’s a nice example in documentation that shows how to route a Pbind-controlled synth through an fx synth. This works lovely. But when Pbind is in a NodeProxy the routing is different and I’m confused where to place that fx synth (within which group, after, tail…). Here’s the code that I cannot make it work:


(
// efx synthdef
SynthDef(\pbindefx, { arg out, in, time1=0.95, time2=1.5;
    var audio, efx;
    audio = In.ar(20, 2);
    efx=CombN.ar(audio, 5, time1, 10, 1, audio);
    Out.ar(out, efx);
}).add;

SynthDef(\eno, { | out = 0, freq, gain |
	var sig, env;
	env = EnvGen.kr(
		Env.pairs([[0, 0], [0.001,1], [0.01,1], [0.5,0.1], [0.6,0]], \cubed),
		doneAction: Done.freeSelf);

	sig = SinOsc.ar(freq: freq );
	sig = sig * env;
	Out.ar(out, sig * gain);
	
}).add;
)


p = NodeProxy.new.play;

// create efx synth
~delayfx = Synth.after(p, \pbindefx, [out: 0]);

(
p.source = Pbind(*[
	instrument:	\eno,
	out:		20,
	scale:		Scale.minorPentatonic(Tuning.wcHarm),
	degree:		Pxrand((-1..6),inf),
	dur:		Pseq([0.5,1,4,2], inf),
	octave:		5,
	gain:		0.8,
]);
)

s.queryAllNodes or s.plotTree shows something like:

NODE TREE Group 0
   1 group
      3269 group
         3400 eno
      3273 pbindefx
      3270 group
         3271 system_link_audio_1
         3272 system_link_audio_1

However,
if I try without NodeProxy, it works:


// create efx synth
~delayfx = Synth.after(1, \pbindefx, [out: 0]);

(
Pbind(*[
	instrument:	\eno,
	out:		20,
	scale:		Scale.minorPentatonic(Tuning.wcHarm),
	degree:		Pxrand((-1..6),inf),
	dur:		Pseq([0.5,1,4,2], inf),
	octave:		5,
	gain:		0.3,
]).play;
)

Have a look at http://doc.sccode.org/Reference/NodeProxy_roles.html

\filter -> function
Filter the audio on the proxy’s own bus, using the first argument to pass in the sound

hjh

Thank you @jamshark70. This works very well:

(
SynthDef(\eno, { | out = 0, freq, gain |
	var sig, env;
	env = EnvGen.kr(
		Env.pairs([[0, 0], [0.001,1], [0.01,1], [0.5,0.1], [0.6,0]], \cubed),
		doneAction: Done.freeSelf);

	freq = freq * ((SinOsc.ar(freq:6) * 0.01) + 1 );
	sig = SinOsc.ar(freq: freq ) * env * gain;

	Out.ar(out, sig);
}).add;
)


p = NodeProxy.new.play;

(
p.source = Pbind(*[
	instrument:	\eno,
	out:		0,
	scale:		Scale.minorPentatonic(Tuning.wcHarm),
	degree:		Pxrand((-1..6),inf),
	dur:		Pseq([0.5,1,4,2,10
		//Prand([8,9,11,13,18,25], 1)
	], inf),
	octave:		5,
	gain:		0.2,
]);

p[1] = \filter -> {|in| CombN.ar(in, 5, 0.9, 10, 1, in); };

)

I wonder what is happening under the hood. So much more to learn.