The module is based on a gate input to determine the stage of the envelope: the attack starts at the rising edge, while the release starts at the falling edge. When designing polyphonic modules, special care must be taken to match the cardinality of the input and output channels. A state machine determines the envelope generation stage and requires a SchmittTrigger to detect a rising edge on the gate input for determining the attack phase. While the gate input is active, the state machine controls the status of the envelope, conditionally switching to the next phase: when the target value is reached, the Attack ends and the Decay starts. Similarly, when the sustain value is reached, the Decay stage ends, and the Sustain stage begins.