Here is a complete example of a Synthdef being played by a pattern and routed and mixed through Ndefs.
I think this plus other examples in this thread demonstrate a lot of different techniques for combining synths, patterns and NodeProxies. I do hope this is helping.
(
SynthDef(\s1, {
var freq = \freq.kr(220);
var cutoff = \cutoff.kr(100);
var fvel = \fvel.kr(8);
var res = \res.kr(0.5).linlin(0, 1, 1, 0.001);
var aeg = Env.asr.ar(doneAction:Done.freeSelf, gate:\gate.kr(1));
var sig = RLPF.ar(Saw.ar(freq), aeg.linlin(0, 1, cutoff, cutoff * fvel), res);
sig = sig * aeg * \amp.kr(0.3);
sig = Splay.ar(sig);
Out.ar(\out.kr(0), sig);
}).add;
)
// monitor - output to speakers
Ndef(\s1).play(vol:1);
// play the synthdef routed through the ndef
(
Pdef(\s1,
Pbind(
\instrument, \s1,
\out, Pfunc({ Ndef(\s1).bus.index }),
\group, Pfunc({ Ndef(\s1).group }),
\degree, Ppatlace([Pseq([0, 4], inf), Pseq([-1, 1, -2, 2], inf)], inf),
\legato, 0.1,
\dur, 0.25
)
)
)
Pdef(\s1).play;
// route the ndef through a delay - output to speakers
Ndef(\delay).play;
Ndef(\delay)[0] = \mix -> {Ndef(\s1).ar};
Ndef(\delay).set(\mix0, 1);
(
Ndef(\delay).filter(10, {|in|
var sig;
var fb = LocalIn.ar(2);
fb = DelayC.ar(fb.reverse, 1, [3/8, 5/8]);
sig = fb * 0.7 + in;
LocalOut.ar(sig);
sig;
})
)
// route the delay through a pitchshift - output to speakers
Ndef(\ps).play;
Ndef(\ps)[0] = \mix -> {Ndef(\delay).ar};
Ndef(\ps).set(\mix0, 1);
(
Ndef(\ps).filter(10, {|in|
PitchShift.ar(in, 2, 2, 0.01, 0.01)
})
)
// route the dry signal, delay, and pitchshift through reverb - output to speakers
Ndef(\verb).play(vol:0.5);
Ndef(\verb)[0] = \mix -> {Ndef(\s1).ar};
Ndef(\verb)[1] = \mix -> {Ndef(\delay).ar};
Ndef(\verb)[2] = \mix -> {Ndef(\ps).ar};
Ndef(\verb).filter(10, {|in| GVerb.ar(in, 10, 5, 1, 1) } );
// adjust mix
Ndef(\verb).set(\mix0, 1, \mix1, 1, \mix2, 1);
// adjust wet/dry
Ndef(\verb).set(\wet10, 1)