Using gates with Event type \set / NodeProxy roles

Hey there,

I’m trying to use gated envelopes in conjunction with patterns. So far I’ve tried to use both the \set event type and the \set NodeProxy role. Would “articulated” notes (just as in PmonoArtic) be possible using NodeProxies? If so, how would I supply a \gate argument, as the internal one can’t be overwritten?

Pdef(\test, Pbind(\type, \set, \id, Ndef(\gateNode).nodeID, \freq, Pwhite(200, 500), \dur, 0.5, \legato, 0.1)).play

Ndef(\gateNode).play

Ndef(\gateNode, {|ggate = 1, freq=400, amp=0.2, ffreq=800| var sig, env; env = Env.adsr.kr(0, ggate.poll); sig = Saw.ar(freq); RLPF.ar(sig!2, ffreq) * env}).mold(2, \audio); // i use 'ggate' bc using 'gate' is not allowed

All the best,
schmolmo

I’m not sure to understand correctly what you are trying to achieve.
Is it that on every Pbind event, you wish your Ndef to detect that it must retrigger the envelop ?
Or you want one Pbind controlling the freq and one controlling the open/close of the envelop ?

However, if you want to control everything through Pbinds and given the following two remarks:

  1. The principle of the triggers and gates controls is to have a value that raises from non-positive to positive.

  2. Instead of writing a Pbind controlling your Ndef you can write this in the Ndef itself. In another slot of the Ndef. So no need to seek for Ndef reference. It is self-referencing.

and not knowing how you want to control your gate, this is a proposition:

(
Ndef(\gateNode).stop.play;
Ndef(\gateNode, {|freq=440, amp=0.5, opened=0| 
	var sig, env; 
	// env =  EnvGen.kr(Env.adsr,Trig.kr(ggate)); // 
	env =  EnvGen.kr(Env.adsr,opened); 
	Poll.kr(Impulse.kr(4),opened,"opened");
	sig=Pan2.ar(SinOsc.ar(freq).cubed*amp*env);
	sig;
	
}
);


Ndef(\gateNode)[1] = \set -> Pbind(
	\dur,Pseq([Pwhite(0.1,2.0,1),Pwhite(0.1,2.0,1)],inf), 
	\freq, Pdup(2, Pwhite(220,440,inf)),
	\opened,Pseq([1,0],inf).poll, 
)
)

The key here is that the Pbind will open and close a gate (here called “opened”) by sending alternatively 1 and 0 to the Envelop. Upon reception of a 1 the envelop will be retriggered. Upon reception of a 0, the decay will be activated.

2 \dur s are computed : one between the \opened=1 and \opened=0 (=how long your envelop will stay opened), one between the \opened=0 and \opened=1 (=how long to wait between the next trigger).

Every values in the Pbind (except the \opened) are then held for 2 events (the “open” event and the “close” event) with the Pdup(2,...) in order to avoid having a change of e.g. frequency on the decay of the note.