The Modular Way to Create Custom Envelope GeneratorsCopyright © 2003-2006 David Haupt, all rights reserved DescriptionThe DH_EnvSeg .sem module is a building block for making custom envelope generators in SynthEdit. Each DH_EnvSeg module generates one segment of an envelope. The modules can easily be linked together to build any kind of multi-stage envelope generator, with any number of stages. An envelope generator built with DH_EnvSeg modules can be used just like a fixed envelope generator, such as an ADSR, to control amplitude, filter cutoff or resonance, or other parameters. |
DH_EnvSeg |
2. How do you link 2 DH_EnvSeg modules together?To link 2 DH_EnvSeg modules:
When the first DH_EnvSeg stops generating its segment of the envelope, its Gate Out triggers the Gate In of the next DH_EnvSeg, and its ending level is passed from its Level Out to the next DH_EnvSeg's Start Level.
|
![]() |
Top FAQ |
3. How many DH_EnvSeg segments can an envelope generator have?An envelope generator can have any number of DH_EnvSeg segments. |
4. What about CPU load?CPU consumption varies with polyphony. Each module in a chain of
DH_EnvSeg modules only uses CPU
while it is generating its own segment of the envelope. Most of the time,
CPU usage is 0. |
Top FAQ |
5. How does the Gate In get triggered?The Gate In is triggered when its input rises from 0 (or negative) to a positive value. |
6. Where would I connect the Midi to CV gate (or other trigger signal) so that it triggers the whole envelope?The Gate In of the 1st DH_EnvSeg module in a chain is the gate for the entire multi-stage envelope. It would typically be connected to a triggering signal such as the gate of a Midi to CV module.The Start Level defaults to 0, so the Start Level plug of the 1st module can be left unconnected unless you want the whole envelope to start at a level other than 0. |
Top FAQ |
7. What gets connected to the Gate In and Start Level of the 1st DH_EnvSeg Module in a chain?
|
8. Where do I get the complete envelope output?The complete envelope is obtained by combining the individual Envelope Out outputs. If you build your envelope generator in its own container (highly recommended), you can just connect all of the Envelope Outs to an Envelope Out plug on an IO Mod.
Tip:
Depending on how you have the modules
interconnected, individual envelope segments
could overlap. In this situation, you may want to combine their Envelope Outs
using a Max module,
so that the resulting total envelope will be the maximum, rather than the sum of
the individual
segment outputs.
|
Top FAQ |
9. What is the Release Gate for?The Release Gate provides a way to end a segment based on an external triggering event, such as a note release. It can be used in 2 ways:
10. How does the Release Gate get triggered?The Release Gate is
triggered when its input falls from a positive value to 0. 11. What should the Release Gate be connected to?It depends on your application. One typical use would be to connect both the Gate In of the 1st segment and the Release Gates of any segments that require Release Gate control directly to the Gate output of a Midi to CV module. When a note is played, the Midi to CV Gate goes positive, triggering the beginning of the envelope, and when the note is released, it falls to 0, triggering the Release Gates of the connected segments. The Release Gates could also be set up so that
retriggering interrupts the generation of the previous note's envelope, as in
the AHD envelope generator below:
|
Top FAQ |
12. Does the Release Gate have to be Connected?If the Duration input is connected, and the segment should always last for a fixed time span, without interruption, there is no need to connect the Release Gate. In fact, the Release Gate should not be connected for an
DH_EnvSeg
module that will generate the release stage of an envelope. Last in the
chain, a release segment gets triggered when the Release Gate of the segment
before it is triggered. If its Release Gate were also connected, it would
end immediately, rather than continuing after the note release.
|
Top FAQ |
14. What kind of values does the Duration input expect?The Duration input
uses the same time cent scale as the SynthEdit ADSR time inputs. The range is
nominally
-10 to +10, but negative values that would result in a duration of
less than one sample will not reduce the duration below that minimum. At a
sampling rate of 44,100 Hz, this is reached at about -8.76 volts, and the
corresponding minimum duration is approximately 0.02 ms. Unless there is good
reason to do otherwise, it would be a good idea to set up your controls so that
the upper limit on a release segment's Duration pin is less than 10 volts.
Duration increases exponentially with voltage, and an input value of
+10 will result in a duration of
approximately 10 seconds. Releases that long in a polyphonic setting will chew
up a lot of CPU because of the number of voices that are kept active. For convenience,
a DH_msToVoltage module can be connected to the
Duration input to permit entry
of the duration in milliseconds.
|
| Linear: the level changes at a constant rate. |
|
![]() |
| Log: the level changes rapidly at first, then more slowly. |
![]() |
![]() |
| Exp: the change is slow at first, then becomes more rapid. |
![]() |
![]() |
| S-curve: the change starts slowly, becomes more rapid, then slows down again. |
![]() |
![]() |
17. Is there any way to make a segment repeat itself?Yes. If the Loop pin has a positive value when a segment's time runs out, DH_EnvSeg re-reads the Start Level (which can change), and repeats the segment. If the Release Gate becomes non-positive, the loop is interrupted, and the segment ends just as it would if it were not looping and the Release Gate became non-positive. |
![]() |
Top FAQ |
18. How can multiple segments be looped?Multiple DH_EnvSeg segments can be looped using a Feedback (delayed) module. The following model has been adapted, with permission, from a demo .se1 by Skye Klein. I've greatly simplified the model to focus on the specific techniques used to achieve multi-segment looping. Any mistakes are mine, not Skye's. In the diagrams that follow, Envelope Out, Release Gate, Duration, and End Level connections that are not specifically related to the looping mechanism have been removed to reduce clutter. Also, of course, most multi-segment loops will have more than just the 2 looped segments shown here, but only 2 (the first and the last) are needed to see how it works. Getting multiple segments to loop essentially involves solving 2 problems: how to retrigger the loop, and how to avoid an abrupt level change at the loop point. The first is the need to retrigger the first segment of the loop when the last looped segment has completed. This requires routing the Gate Out signal from the last segment in the loop (Loop Seg2 in the diagram below) back to the Gate In of the loop's first segment (Loop Seg1 below). Because of SynthEdit's limitation on feedback, this connection has to go through a Feedback (delayed) module. In the example below, an incoming gate signal is used to control a 1->Many switch through a Voltage To List converter. As long as the incoming gate signal is high, Loop Seg2's Gate Out is routed through the Feedback (delayed) back to Loop Seg1's Gate In to retrigger the loop. When the incoming gate signal drops, Loop Seg2's Gate Out is switched to the Release segment's Gate In, and the looping ends.
The second problem that has to be solved is how to pass the Level Out from the segment at the end of the loop back to the beginning segment's Start Level so that the loop transition will be smooth. The method diagrammed below does this cleverly, avoiding the need for feedback. This is possible because the loop will only occur if Loop Seg2 runs to completion, and at that point, its Level Out value will equal its End Level input, which can be taken directly from the Seg2 End Lvl slider.
There is a timing issue that must be dealt with, however. The first time the envelope is triggered, before it begins looping, Loop Seg1's Start Level must come from the segment before it, in this case, the Attack segment. After that, it needs to come from Seg2's End Level. Thus, we need to have the Many->1 switch set to "Attack Lvl Out" for the first pass through Loop Seg1, and to "Seg2 End Lvl" for all subsequent passes. This is accomplished by using a Monostable module to generate a pulse of the same duration as Loop Seg1's first pass*. As soon as the Attack segment ends, its Gate Out triggers the Monostable, and the input to the Voltage To List goes high, selecting the Attack Level Out and sending it to Loop Seg1's Start Level. The pulse ends at the end of the first pass through Loop Seg1, dropping the input to the Voltage to List to 0, which switches the switch to the Loop Seg2's End Level position for subsequent passes.
|
Top FAQ |
|
19. How do I set up a basic Attack segment?To use an DH_EnvSeg module
for an envelope's attack stage:
Optional:
|
Top FAQ |
|
20. How do I set up a basic Decay segment?To use an DH_EnvSeg module
for a decay stage:
Optional:
|
Top FAQ |
|
21. How do I set up a basic Sustain Segment?To use an DH_EnvSeg module
for a basic sustain stage, that will hold until a note is
released:
|
Top FAQ |
|
22. How do I set up a basic Release segment?To use an DH_EnvSeg module
for a final release stage:
Optional:
23. What if I find a bug, or have a question that isn't answered here?To report problems, or to request technical assistance with using
DH_EnvSeg, |
||