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 NodeProxy roles | SuperCollider 3.12.2 Help

\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.

1 Like

I was going to open a new topic, but my question is very close to the one in this thread.

I’m trying to understand more about NodeProxy roles. Everything works in the example below, except I did not expect the result in the last line:

// Monitor an Ndef
Ndef(\b).play;

// set some source (slot 0 by default)
Ndef(\b, Pbind(\dur, 0.5, \degree, Pwhite(0, 10), \legato, 0.1, \amp, 0.5));

// add a 'filter' role at slot 1 
Ndef(\b)[1] = \filter -> { |i| Splay.ar(PitchShift.ar(i, 0.2, [1.5, 1.6, 1.7])) };

// wet level control for slot 1
Ndef(\b).set(\wet1, 0);
Ndef(\b).set(\wet1, 1);

// add another 'filter' role in slot 2
Ndef(\b)[2] = \filter -> { |i| FreeVerb.ar(i, 0.5, 0.94) };

// replace what's in slot 2
Ndef(\b)[2] = \filter -> { |i| CombC.ar(i, 0.5, 0.4, 4) };

// wet level controls
Ndef(\b).set(\wet2, 0);
Ndef(\b).set(\wet2, 1);

// so far so good...
// what I don't understand happens next:
// if I set a different source, I stop hearing all 'filter' slots I previously added

Ndef(\b, Pbind(\degree, -10));

Is there a way to change the source at slot 0 and still hear the later slots fx? I can’t seem to find a way. I know I could write all this as separate Ndefs and simply route one through the other, then I could change the ‘source’ Ndef at will. But I am curious if there is a way to achieve similar behavior within the same Ndef and its slots.

Thanks!

This is how I do this! There may well be better ways though.

Ndef(\b)[0] =  Pbind(\degree, -10);
2 Likes

this is what i do as well

2 Likes

Thank you! Somehow I had not tried that :stuck_out_tongue: