Design & implement our own envelope type and replace Redmon's analogue type envelope
visualizersdotnl opened this issue · comments
@paulcoops Sketches, ideas: here please :-)
We're planning to do this in a new branch of the engine.
What about using Cubic Bézier Curves for the Attack Decay and Release phase.
It introduces a new parameter group per envelope curve containing:
- pointA (float, float) 0..1
- pointB (float, float) 0..1
- duration (float) 0..30s?
- easeOut (bool)*
The start and end points for the Cubic Bézier Curve are derived from the easyOut bool.
*I don't think we want this to be an automatable parameter. Attack is always an ease-in, so we can decide to hardcode this value for the type of envelope on both UI and Engine side.
Sustain uses a level (float) which is basically the decay curve's, end point's y value.
Optionally, we can add a decay rate on the sustain, perhaps ranging from -1..1, so you can have a sustain phase that gets softer or louder over time.
I've just replaced the convoluted ADSR for a customized copy of Juce's ADSR class. It's a good place to start. Curvature is not evaluated right now. I haven't submitted at time of writing either :-)
Submitted. That decay on sustain is implemented to simulate piano pedal mode by the way.
Must fix skipping of attack phase when 'piano pedal mode' enabled. I'll take care of that.
I ended up using a cubic curve where the control points are calculated from a single value. Visualization of the same curve is in the beta branch of the R&D plugin.
Looks and works fine. Tight code too. Closing this issue!