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, {|ggate = 1, freq=400, amp=0.2, ffreq=800| var sig, env; env =, ggate.poll); sig =;!2, ffreq) * env}).mold(2, \audio); // i use 'ggate' bc using 'gate' is not allowed

All the best,

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, {|freq=440, amp=0.5, opened=0| 
	var sig, env; 
	// env =,; // 
	env =,opened);,opened,"opened");*amp*env);

Ndef(\gateNode)[1] = \set -> Pbind(
	\freq, Pdup(2, Pwhite(220,440,inf)),

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.