I am curious why you went with phasors rather than timer segments. Is it more CPU efficient?
1 Like
The phasor will freeze at its current output value if you set the frequency to zero. I use this to create the sustain. when the output from the first phasor circuit reaches 0.5 I switch the frequency to zero so that the spline output also freezes. When the gate drops to zero, I switch to the other phasor circuit which outputs 0.5 to 1. When it reaches 1 I freeze the second circuit until the gate goes high again. I initially tried used a single phasor but ran into some timing issues. I might still be able to reduce it to one phasor.
2 Likes
Now I remember why I used two phasors. If the gate goes low before the attack phasor reaches 0.5, I wanted to switch to the release phase immediately and it was difficult to implement with a single phasor. I struggled a bit with what to do when the gate dropped before the spline reached mid-point. I had circuitry that grabbed the spline value at when the gate dropped and used it to scale the release phase so that there would be a smooth transition from attack to release, but it added considerably to the complexity of the module, so in the end I decided that the simpler approach was preferable even though it can introduce an abrupt step in the output if the gate goes low early.
3 Likes
How difficult would it be create a similar module where one uses splines to define the envelope contour and having the total envelope time being the only time control?
I am a total newb and still finding my legs.
Pretty simple really. You could use either a timer node or a phasor depending on whether you want the envelope to repeat or not. The timer node starts at 0 when reset and simply counts the seconds so you just need to scale the output so that it reaches 1 at the end of the envelope time. So for a 1 second envelope you can use the output unscaled, for a 1/2 second you would multiply be 2, for a 2 second you would divide by 2. etc. Once you have scaled the output you use it to drive the spline node. The phasor outputs a ramp from 0 to 2pi so you divide the output by 2pi to scale it so that it goes from 0 to 1. Use the sync input as the trigger. Have a look at these. The 0.001 in the expression is to prevent a divide by zero issue when the knob is set to 0.
simple spline envelope.audulus (3.4 KB)
2 Likes
Thank you so much! This is very helpful.
1 Like