Bug in 7-segment envelope patch

The 7-segment envelope patch doesn’t sustain infinitely. The duration for the sustain segment needs to be negative, otherwise it’ll execute the entire envelope when you turn on the toggle, then execute the release segments again when you switch it off.

Here’s a fixed example. I also added the ability to scale the amplitude of the envelope by the trigger value (like adsr~ does).

– Pasted Max Patch, click to expand. –

Copy all of the following text. Then, in Max, select New From Clipboard.