About "release node"

Hello everyone, I need help about this in the @elifieldsteel’s book, p.57 Cf.the patch below:

(
f = { |gate = 1|
	var sig, env;
	env = EnvGen.kr(
		Env.new(
			[0, 1, 0.2, 0],
			[0.02, 0.3, 1],
			[0, -1, -4],
			2
		),
		gate
	);
	sig = SinOsc.ar(350) * 0.3;
	sig = sig * env;
	sig = sig ! 2;
};
)

Eli writes this: “( the 2, the release node, the 4th argument of Env.new)…means the envelope signal will sustain at a level of 0.2”

So, 2 questions:

  1. What does exactly this “2”? and
  2. why a level of 0.2?
    thanks for your precious help! :smiling_face:

2 corresponds to the third entry in the envelope levels array: [0, 1, 0.2, 0]

1 Like

The way I think through it is:

  • Envelope segment 0 rises to 1 in 0.02 seconds.
  • Segment 1 falls to 0.2 in 0.3 seconds.
  • Segment 2 falls to 0 in 1 second.

releaseNode: 2 means that segment 2, and any segments after it, will serve as the release when gate becomes 0. To do that, the envelope has to hold at the target level of segment 1 (= 0.3).

It’s confusing! This is the mnemonic that works for me. (I didn’t work out a similar one for loopNode though, since I haven’t used it very much.)

hjh

1 Like

@jamshark70 and @jordan :star_struck: thanks a lot!! I think I understand now:
if I resume, 2 is the 3 value in the level array (0.2) and sustain at this volume value while the gain is open…it’s correct? :thinking:
But if we want to change that value with an other one (not in the Array I mean), how can I do?

The wording is a bit unclear, but, envelope breakpoints can be kr signals (note, SynthDef arguments are also signals – so you can use SynthDef arguments in Env). When starting an envelope segment, the signal is sampled-and-held as the envelope parameter, and the envelope segment is performed against that. You can’t modulate the sustain level while it’s holding, but the sustain level could be different for different synths, without rebuilding the SynthDef.

hjh

1 Like

ok @jamshark70 thanks a lot!
I see very well now despite the slightly shaky wording of my sentence… :sweat_smile:

I’m sorry the wording in the book is not as clear as I intended it to be. I second @jamshark70’s comment that “It’s confusing!” There are many features and possibilities related to Env and EnvGen not discussed in the book. It’s impossible to cover everything, so the challenge was paring back information so that the discussion is digestible, but still broadly helpful.

Regarding your original question,

I tried to make this clear at the start of the second paragraph on p. 57, describing the fourth argument of Env.new() as

“an integer representing an index into the levels array, indicating the value at which the envelope will sustain.”

So, as @jordan has already concisely pointed out, 2 is the index, and the value in the levels array at index 2 is 0.2. So, when the envelope signal arrives at this value, it will hold the value as long as the gate remains positive. As discussed, envelope breakpoints can be arguments/signals, but ultimately I was concerned that section 2.5.3 would become overwhelming and unwieldy if I wandered too deeply into these types of possibilities.

Eli

1 Like

thank you Eli, @elifieldsteel for taking the time to intervene, this “2” is perfectly clear to me now and indeed after rereading this point is well clarified in the book page 57…on first reading, the concept was not automatically obvious…
And thank you: @jordan @jamshark70 for responding so kindly…This forum is a very useful place of essential resources in case of difficulty!. :star_struck:

1 Like