I would like to program an attack-decay envelope that is triggered by a single-sample impulse signal (the default [click~] for example).
For example, if the attack time is 100 ms and the decay time is 2000 ms, when the envelope receives an impulse, the envelope goes from 0 to 1 in 100 ms, then goes back to 0 in 2000 ms (let's assume the envelope is linear for this thread). Total envelope time should not exceed 2100 ms.
For any attack and decay times, the envelope must always reach 1 (or very very close to).
Also, it should be possible to retrigger this envelope during the decay stage.
Is there a solution using regular MSP processing?