DH_EnvSeg

The Modular Way to Create Custom Envelope Generators

Copyright © 2003-2006 David Haupt, all rights reserved

Description

The 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

FAQ

1. How does it work, in a nutshell?

2. How do you link 2 DH_EnvSeg modules together?

3. How many DH_EnvSeg segments can an envelope generator have?

4. What about CPU load?

5. How does the Gate In get triggered?

6. Where would I connect the Midi to CV gate (or other trigger signal) so that it triggers the whole envelope?

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?

9. What is the Release Gate for?

10. How does the Release Gate get triggered?

11. What should the Release Gate be connected to?

12. Does the Release Gate have to be Connected?

13. When a note is released, I want it to go straight to the release, skipping everything in between. How do I do that?

14. What kind of values does the Duration input expect?

15. Does the Duration input have to be connected?

16. What are the Response Curves?

17. Is there any way to make a segment repeat itself?

18. How can multiple segments be looped?

19. How do I set up a basic Attack segment?

20. How do I set up a basic Decay segment?

21. How do I set up a basic Sustain Segment?

22. How do I set up a basic Release segment?

23. What if I find a bug, or have a question that isn't answered here?

 

Top

1. How does it work, in a nutshell?

When the Gate In is triggered, an DH_EnvSeg module starts sending a signal to its Envelope Out output. The signal's level starts at the Start Level, and rises or falls to the End Level, at a rate controlled by the Duration input. This continues until the time specified by the Duration has elapsed, or the Release Gate signal falls to 0. At that point, the module drops the Envelope Out signal to 0, sends a triggering pulse to its Gate Out output, and send its final level to its Level Out output.

Top
FAQ

   

2. How do you link 2 DH_EnvSeg modules together?

To link 2 DH_EnvSeg modules:

  • Connect the Gate Out of the 1st to the Gate In of the 2nd
  • Connect the Level Out of the 1st to the Start Level of the 2nd.

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.

Release segments with long durations in polyphonic situations will result in high CPU usage with any envelope generator. In tests where the same release duration, polyphony and input was used with both, DH_EnvSeg's CPU usage was similar to that of the standard SE ADSR.

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?

See #6 above.

 

 

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:

  • With the Duration input also being used, the Release Gate provides a way to end the segment before the time specified by the Duration has elapsed.
     
  • With the Duration input not connected to anything, the segment will be sustained until the Release Gate is triggered.
     

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:


Here, the Monostable's output, which is -5 in the absence of a pulse, is subtracted from the constant 5 (5-(-5)=10), sending a 10 to the Hold and Decay segments' Release Gates. If a new note is triggered, the Gate signal fires the Monostable pulse (pulse width set to a very short value so it will be shorter than the duration of the Attack segment). The subtraction becomes (5-(5)=0) , and a 0 is sent to the Release Gates. If this happens while the Hold or Decay segment are being generated, they immediately stop, and envelope generation continues from the beginning of the Attack segment, which has been fired by the Gate signal.

 

 
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.


13.
When a note is released, I want it to go straight to the release, skipping everything in between. How do I do that?

To set up envelope segments so that they will be cut short or skipped if a note is released, connect the Release Gate of each of these segments to a signal that will fall to 0 when the note is released, such as the Gate output of a Midi to CV module. When the release trigger occurs, the currently active segment immediately stops where it is, and passes its current level and a gate trigger signal to the next segment. When the in-between segments receive a Gate In trigger and their Release Gate has already been triggered, they immediately pass the received level and a gate trigger signal to the next segment without generating any envelope output. The result is that the next segment in the chain that is not connected to the release trigger starts generating its segment at the level at which the interrupted segment stopped. Typically this would be the envelope's final release segment.

 


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.

 


15. Does the Duration input have to be connected?

If the Duration input is not connected, the DH_EnvSeg module becomes a simple sustain segment. When triggered, it will send its Start Level to its Envelope Out until its Release Gate is triggered. The Release Gate must be connected in this case.
 

Top
FAQ


16. What are the Response Curves?

The Response Curves determine how the rate of change varies as the envelope signal progresses from the Start Level to the End Level. Four types are available: linear, logarithmic, exponential, and an S-shaped function.
 

Top
FAQ

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.


(*Note: Some time conversions were necessary because the Monostable's Pulse Length is on a linear scale of 10 volts = 1 second, while DH_EnvSeg's Duration input uses the same time cent scale used by SE's ADSR. The value on the Seg1 Duration slider above is in milliseconds. It is multiplied by 0.01 to convert from milliseconds to tenths of seconds for input to the Monostable Pulse Length. A DH_msToVoltage converts the milliseconds to volts on the time cent scale for Loop Seg1's Duration pin.)

 

 

Top
FAQ

19. How do I set up a basic Attack segment?

To use an DH_EnvSeg module for an envelope's attack stage:

Required:

  • Connect the Gate In to the triggering source. (See # 6 above)
  • Provide a value for the End Level input. This will be the peak level reached at the end of the attack.
  • Connect and provide a value for the Duration input. This will be the attack time.
  • Connect the Envelope Out to the common output point. (See #8 above)

Optional:

  • Provide a value for the Start Level, if it can be other than 0.
  • Connect the Release Gate, if the attack should be cut short on a release. (See #9-11 above)
  • Select a Response Curve (default is Linear)
Top
FAQ

20. How do I set up a basic Decay segment?

To use an DH_EnvSeg module for a decay stage:

Required:

  • Connect the Gate In and Start Level to the preceding segment's Gate Out and Level Out
  • Provide a value for the End Level.
  • Connect and provide a value for the Duration input. This will be the decay time.
  • Connect the Envelope Out to the common output point. (See #8 above)

Optional:

  • Connect the Release Gate, if the decay should be cut short on a release. (See #9-11 above)
  • Select a Response Curve (default is Linear)
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:
 
Required:

  • Connect the Gate In and Start Level to the preceding segment's Gate Out and Level Out.
     
    Important Note: The sustain level will be passed in from the previous segment via the Start Level. Whatever is connected to the previous segment's End Level will control the sustain level.

  • Do not connect anything to the Duration input. (See #15 above)
  • Connect the Release Gate to the release triggering source. (See # 9-11 above)
  • Connect the Envelope Out to the common output point. (See #8 above)
Top
FAQ

22. How do I set up a basic Release segment?

To use an DH_EnvSeg module for a final release stage:

Required:

  • Connect the Gate In and Start Level to the preceding segment's Gate Out and Level Out
  • Connect and provide a value for the Duration input. This will be the release time.
  • Do not connect anything to the Release Gate (See #12 above)
  • Connect the Envelope Out to the common output point. (See #8 above)

Optional:

  • Provide an End Level, if it can be other than 0.
  • Select a Response Curve (default is Linear).
     

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,
email dave@dehaupt.com.

Top
FAQ