Hello,

I have this SynthDef:

(
SynthDef(\perc1, {
arg out=0, gate=1, pan=0, atk=0.001, rel=0.2, amp = 0.5;
var env, sig;
env = EnvGen.kr(Env.perc(attackTime:atk, releaseTime:rel, curve:-4), gate:gate, doneAction:2);
sig = WhiteNoise.ar();
Out.ar(out, Pan2.ar(sig, pan, amp)* env);
)

and this Pbind:

(
Pbind(\instrument, \perc1,
\pan, 0,
\dur, Pseq([0.25, 0.25, 0.25, Rest(0.25), 1, Rest(2)], inf),
\rel, Pseq([0.05, 0.1, 0.2, Rest(), 0.2, Rest()], inf)
).play;
)

When I play the Pbind, The Pbind works properly, but there is this message:
-> an EventStreamPlayer
(and so on…)

I can avoid having this message by changing certain key values of the Pbind. For example, the first value of \ rel in the Pseq.

Why? I don’t understand… And is there a way to avoid that?

The short answer is, just remove the “gate” argument from your SynthDef (and from the EnvGen argument list). It’s not really doing anything useful here, since the perc envelope will finish and release on its own. But because the gate argument exists, the event assumes it should be used to finish the note, so it tries setting “gate” to zero on a Synth node that is already completed and freed on the server (Env.perc duration is just attackTime + releaseTime).

From EnvGen documentation for “gate” argument: “If the Env is fixed-length (e.g. Env.linen, Env.perc), the gate argument is used as a simple trigger.” (i.e. just to start the envelope, not to release it).

From “Pattern Guide 08”: “The default behavior for releasing a note is to look in the SynthDesc for an argument called \gate. If it’s present, the event will send a node.set(\gate, 0) message to the server. If not, no release will be sent; it’s assumed that the SynthDef will release itself after a given length of time.”

1 Like