EnvGen.ar(Env gate not accesable without declaring variable

When using the EnvGen.ar(Env
Going through the arguments of Env, we can enter an array of values , for level ,time,curve
All works great but there is no done action nor a gate argument , the only other arguments are release node , loopnode and offset

(
{
	EnvGen.ar(Env([0,1,0],[0.001,0.250],[0,-10],))*SinOsc.ar([1000,1000])}
.plot(1))

Browsing through the manual ,it shows EnvGen.ar(env …notice the use of env with no capital and to acces the gate the Env is declared as a variable
SO if somoene can show me how to acces the gate without declaring variables

The gate must be a SynthDef argument, and you supply it to the gate input of EnvGen (not Env).

An Env (envelope definition) doesn’t have a gate parameter at all. (It doesn’t need one.)

An EnvGen performs the envelope. The gate influences the way the envelope is performed. So you put the gate here.

On second thought… there is a way: EnvGen.kr(Env(/* your envelope stuff here */), NamedControl.kr(\gate, 1), doneAction: 2).

hjh

or to be most terse, I like to write:

Env(/* your envelope here */).kr(\gate.kr(1,doneAction:2))

Yes, that’s a good alternative.

Oh, but I just spotted a typo. Shouldn’t it be like this?

Env(/* your envelope here */).kr(\gate.kr(1), doneAction:2)

For the last several years, I tend to prefer readable code over concise code. Particularly in this case, addressing a new user’s question, my opinion is that it’s better to be explicit about the classes that are involved – so that the code itself directs the user to EnvGen, Env and NamedControl help files. (In the shorter version, there are two .kr's that do different things, and it requires some experience to know where to look for help on them – and I suspect the typo would be less likely to occur when being explicit about the structure too.)

I’m definitely not saying the shorter version is wrong – just pointing out that I had a reason for posting the longer version.

hjh

That’s an excellent point. I’ve learned many shortcuts from examples often not learning what’s really going on for months (if ever!)