online now

We have 92 guests and no members online



envelope control ( ADSR )

Each digitally controlled oscillator (DCO) as well as each of the output mixers are capable of varying their output amplitude over time. This allows for the ability to mimic real world instruments as well as other non-worldy effects. This mechanism, called amplitude envelope is commonly defined in the waveform synthesis through a a series of parameters in both time and amplitude that define specific points to construct a graph of how amplitude varies over time. Envelopes are activated and deactivated through the use of the trigger() and release() functions, and are available for poly and synth modes.

setEnvelope ( OSC_ALL , AT_2MS , 0.60f , DR_2MS , 0.40f , DR_575MS , 0.0f );

The GinSing system utilizes the Soundgin's internal definition of ADSR, which divides the envelope into four discrete sections of time with key amplitude values along the way. ADSR stands for Attack, Decay, Sustain, and Release. When a waveform is first triggered, the volume can be made to ramp up from zero to a predefined maximum value over a specified amount of time, as you can see in this diagram:


Most real world sound generation has a definite attack stage because it takes time for the sound to reach full volume, and may be short or long depending on the type of instrument being synthesized. Attack is specified by two values - the time it takes from trigger full attack, and the amplitude at that time.

Likewise, the Decay stage is a settling down of the ampltiude once the attack stage has been completed. The decay allows the amplitude to fall off due to natural settling of an instrument. For example, a plucked violin string does not maintain its initial value for very long as the string settles into a mode of vibration shortly after the string is excited. The Decay is specified as a duration and an amplitude that transitions it into the Sustain stage.

The Sustain stage is a measure of how long the sound maintains its decay value before fading away. Sustain can be long for instruments that can be held due to continued energy being applied to the sound generation. For example, a trumpet can maintain a constant volume for a long amount of time until the trumpeter turns blue and passes out. This will no doubt be followed by a very quick release of the sound. There are no parameters that define the Sustain stage because the amplitude is fixed at the decay level, and the time for sustain is determined by how long the waveform is still active. Once a waveform is released, the sustain stage is over and the release stage begins.

The Release stage is the opposie of the Attack stage and allows the sound to fade back to zero (or some other value ) over time. The amount of time spent in the release stage varies greatly depending on the type of instrument being synthesized.

Although the amplitude values for ADSR can be defined over a wide range ( 0.0 - 1.0 in 255 steps ), the timing values are specified through a set of fixed values that are specified when setting an envelope. For example, this call to setEnvelope defines the graph as:  Attack ( 2 milliseconds in duration to a value of 60% full volume ), Decay ( 2 milliseconds to 40% volume ), and Release ( 0.575 seconds to 0% volume ). Note as mentioned above that the Sustain has no parameters as its volume will be fixed at the decay value for the amount of time the waveform is triggered until it is released.

attack duration decay/release duration

AT_2MS 2 milliseconds


2 milliseconds
AT_8MS 8 milliseconds


6 milliseconds
AT_16MS 16 milliseconds


10 milliseconds
AT_38MS 38 milliseconds


15 milliseconds
AT_56MS 56 milliseconds


23 milliseconds
AT_68MS 68 milliseconds


34 milliseconds
AT_80MS 80 milliseconds


40 milliseconds
AT_100MS 0.10 seconds


48 milliseconds
AT_250MS 0.25 seconds


59 milliseconds
AT_500MS 0.5 seconds


0.145 seconds
AT_800MS 0.8 seconds


0.292 seconds
AT_2800MS 2.8 seconds


0.455 seconds
AT_5600MS 5.6 seconds


0.575 seconds
AT_11200MS 11.2 seconds


1.5 seconds


2.785 seconds


4.873 seconds