Envelopes and patterns: creating standard shape envelopes but using them as gated

Hi all!

Would it be possible to use the syntax of a standard shape envelope but behaving like a gated one (and vice-versa)? For instance Env.xyc as gated envelope and Env.step as standard shape?

The default Env.new([0,1,0],[1,1]) only provides a stardand shape envelope and never provide a gated envelope?

How can I make standard shape and gated envelope behave equally when using patterns? In this case, the gate envelope example is the intended one:

(
SynthDef(\semidef1, { arg out=0, freq=440, amp=0.1, pan=0, gate=1;
	var sig, env;
	sig = SinOsc.ar(freq);
	env = EnvGen.kr(Env([0,1,1,0],[1e-5, 1.0, 1e-5]),gate, doneAction: Done.freeSelf);
	OffsetOut.ar(out, Pan2.ar(sig*env, pan, amp));
}, [\ir]).add;

SynthDef(\semidef2, { arg out=0, freq=440, amp=0.1, pan=0, gate=1;
	var sig, env;
	sig = SinOsc.ar(freq);
	env = EnvGen.kr(Env.asr(1e-5, 1.0, 1e-5), gate, doneAction: Done.freeSelf);
	OffsetOut.ar(out, Pan2.ar(sig*env, pan, amp));
}, [\ir]).add;
)


Pdef(\x).clock_(TempoClock(240/60)).quant_(1).play;

Pdef(\x, Pbind(\instrument, \semidef1, \freq,440, \dur, 1.0, \amp, 0.1));
Pdef(\x, Pbind(\instrument, \semidef2, \freq,440, \dur, 1.0, \amp, 0.1));

Thanks!

See the definition of releaseNode in the help for Env.new. If you use a timed envelope method, and then specify a releaseNode, then it becomes a gated envelope.

hjh

1 Like