Linear and Exponential Slew

39%20AM

Slew

This module provides a linear and exponential slew. It can be used as an attack-release or in other instances where a slew is desirable. Since it allows for both positive and negative signals, I’ve labeled the controls rise and fall rather than attack and release. Rise sets the value for an increasing signal and fall for a decreasing one. There are two primary outputs, an exponential and a linear. Each output has a gate that signals the end of rise and the end of fall. For the linear envelope the rise and fall are considered to have ended when the delta is less than 0.001. For the exponential the threshold is 0.01. These values can be adjusted internally. It has a toggle to control whether the slew is constant rate or constant time. When set to rate, the time to reach the end of the rise or fall varies with the difference between the start and end values (gate height), and when it’s set to time the time for the rise or fall is constant. Useful for keyboard portmanteau. Version 2 was an earlier version without the EOR and EOF gates. Version 1.0 was an earlier design limited to positive numbers only with a separate linear and exponential module.


I/O

Input Signal Range Notes
input any number generally but not necessarily some kind of gate

Output Signal Range Notes
lin 0-gate height linear envelope
exp 0-gate height exponential envelope
EOR end of rise for the respective envelope threshold is 0.001 for linear and 0.01 for exponential
EOF end of fall for the respective envelope threshold is 0.001 for linear and 0.01 for exponential

Controls

Control Function Notes
rate/time toggle sets constant rate or constant time
attack sets attack value
release sets release value

Displays

Meter Displays Notes
none


Version History

Revision File Date Notes
3.2 Linear-Exponential Slew V3.2.audulus (78.8 KB) 11/10/2019 fixed issue when time = 0. updated expression for linear slew module
3.1 superceded 11/09/2019 fixed issue when time = 0. Limited minimum time to 0.001.
3.0 superceded 11/09/2019 added end-of-rise and end-of-fall gates per suggestion from @robertsyrett
2.0 superceded 11/09/2019 updated to support negative values and consolidated to one module
1.0 superceded 11/09/2019 initial upload

Demos

Revision File Date Notes
none
4 Likes

OK, we are one step away from creating a universal slope generator!

Is it possible to create a gate output for end of rise and end of fall?

1 Like

Should be, at least for the linear, for the exponential we’ll have to set a threshold since it never actually reaches steady state. Sounds like V3

2 Likes

I ended up adding a set of gates for each ramp type since the tail end of the exponential ramps is rather extended. I set the thresholds to 0.001 for linear and 0.01 for exponential, but they’re easy to adjust. I didn’t scale the linear vs. the exponential since I didn’t see any good way to make them “equivalent” that wasn’t arbitrary.

1 Like

Very cool! More stuff to wrap my head around.

I was trying to self-patch it like the USG and got some interesting behavior:


self patching creates interesting results.audulus (81.7 KB)

1 Like

Looks like there’s some instability if the time is set to 0.

1 Like

Fixed it temporarily. Think I’ll look at it again tomorrow to see if I can clean it up,a bit.

1 Like

No worries, I’m still having fun messing around with this one.

Fixed it properly. The problem was overshoot in the calculation of the new value for the linear unit. The previous design caused the output to oscillate around the input value. When the time is low, the incremental change per sample is large, and the oscillation is apparent. I rewrote the expression to eliminate the oscillation.

1 Like