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.)
@jamshark70 and @jordan 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?
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.
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.
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!.