Spline-based Envelope Generator

SplineAR

Spline AR

Spline AR is an envelope generator which uses a spline node to create the envelope.The attack and release times are adjustable. When the gate goes high (attack) the active point on the spline moves from the left of the spline to the center and when the gate goes low, the active point moves from the center to the right of the spline. By adding, removing and adjusting points on the spline it is possible to create a variety of envelope shapes. When the velocity switch is on (red) the incoming gate velocity is captured and modulates the envelope output. Because the transitions between stages can be abrupt, depending on the start and end values of the spline and the gate timing, some slew limiting may be necessary to prevent audible clicks.


I/O

Input Signal Range Notes
gate gate signal initial gate height modulates signal when velocity switch is on

Output Signal Range Notes
envelope%20out 0-1 or 0-gate velocity

Controls

[Control] Function Notes
attack attack time exponential from 0.01 to 4 sec.
release release time exponential from 0.01 to 4 sec.
vel velocity mode switch when on modulates output using initial gate height
spline spline control first half is attack, second half is release

Displays

none


Version History

Revision File Date Notes
1.1 SplineAR V1.1.audulus (18.1 KB) 11/11/2018 replaced clamped knobs (for Windows users)
1.0 SplineAR V1.0.audulus (18.1 KB) 11/10/2018 initial upload to Forum

Demos

Revision File Date Notes
1.1 SplineAR demo V1.1.audulus (29.0 KB) 11/11/2018 update spline AR module to 1.1
1.0 SplineAR demo V1.0.audulus (29.0 KB) 11/10/2018 initial upload to Forum
6 Likes

Nice!

1 Like

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