
Reaktor Tutorials
Building Envelopes in Reaktor Core, Part IV
Welcome to the fourth installment of our series on building envelopes in Reaktor Core.
In this tutorial, I’ll be expanding upon our design to allow for user adjustable curves (previously we have worked with both linear and logarithmic curves).
ADJUSTABLE CURVE FUNCTION
[aside title = “Pro Tip”]You may want a linear envelope when using as a modulator. [/aside]
Many envelopes in commercial synths use a linear attack stage, and have logarithmic stages for both the decay and the release. I am not sure of the reason for this, but I have observed it in a few synths. The envelopes in Reaktor Primary also follow this convention. Other synths, such as Ableton’s Operator, and Native Instruments’ Absynth, allow the user to control the curve shape of each stage of their envelopes.
To allow for this, I made some additions to the ‘Stage’ macro from the previous tutorials. The old one looked like this:
This is a very simple linear envelope stage. We were able to get it to act like a logarithmic stage by using the decibel scale and converting to amplitude later. This time, however, we’re going to build the curve of the envelope directly into the stage itself:
Where the new input, Alpha, is the curve parameter.
The great thing about this implementation is that when Alpha is equal to 1, the stage generates a linear curve. Anything greater than that and you get a curve that sticks closely to the lower value, anything less and you get a curve that sticks closely to the upper value. It’s a very versatile engine.
Allowing your envelopes to be linear can actually be very helpful – envelopes aren’t always used to control the amplitude of an oscillator. Sometimes they are used as modulators as well, and it may be desirable to modulate linearly, depending upon the parameter.
There is one problem with this setup so far, however, which is that the shape of the curve will change depending upon whether the Start input is larger than the End input (which happens quite often). So I added a bit of code:
To accommodate this new design, I updated the larger structure as well. Since we’re no longer using the decibel scale, we don’t need to translate the output anymore. Also, we can go back to simply multiplying the gate by the Peak and Sustain values, no more adding together their decibel values like last time.
Finally, a new input accepting the Curve value was added. Any value greater than 0 can be used as an input.
This is still very similar to the original structure I posted a few tutorials back. Of course, it would be an obvious addition to allow each stage to have it’s own Curve paramter, I just used a single value for simplicity in this example.
FURTHER UPGRADES
There is still a ton of stuff we can do here. For starters, we now have an envelope that takes at least 6 user-supplied values (up to 8 if we want each stage to have it’s own Curve value). This is a little complex. Worse, the user is not given any particular way to view the shape of the envelope that’s being created.
This would be fine for a simple ADSR envelope, but we’re reaching a point where a well-designed display can make the difference between a usable design and an obtuse design. A good display for an envelope, however, can be more complicated than the envelope itself! There is much to consider.
Another upgrade I’d like to add is a looping option that repeats the Attack and Decay stages instead of simply sustaining (Operator has an option like this, for example). We’ll get into all of this and more in the tutorials to come!
Have a Question or Comment About This Tutorial?
Want to ask a question about this tutorial or perhaps you have something to add?
Click through to our forum post about this tutorial and join the conversation!