[line~] envelope retrigger clicks

Steffen Günther's icon

Hello there,

being pretty new to the MSP side of Max I am trying to solve clicks in my audio signal. I am generating the envelope for [cycle~] with [line~]. The clicks happen when I trigger the envelope before the previous motion is done because the signal is suddenly set to 0 instead of ramped. I was thinking of different ways to ramp to 0 before the new envelope gets send to [line~] but I was not successful yet. Does anyone have a solution or a pointer into the right direction? I have included the patch. Would be awesome if someone can help with this.

line~_envelope_clicks.maxpat
Max Patch

nouserid's icon

Max Patch
Copy patch and select New From Clipboard in Max.

Steffen Günther's icon

Thanks for the reply! Are you sure you uploaded the right patch? Looks like the one I pasted.
I just had an Idea that seems to work. Although I have the feeling it should look better than this.

line~_envelope_noclicks.maxpat
Max Patch

Christopher Dobrian's icon

There's no need to leap to 0 at the beginning of each envelope. The line~ will just go from wherever its current value is.

Max Patch
Copy patch and select New From Clipboard in Max.

Roman Thilenius's icon


...which will also click.

and this click is somehow unavoidable and not releated to max or beeing a noob.

to get rid of it you would need a form of interpolation, but as soon as you implement interpolation, this causes a delay and in hard cases the attack will never reach 1.

your idea by using another 10 ms segment goes in the right direction, but in half the possible cases it wont change much.

better would be a rampsmooth~ or slide~ based system behind the line~ object.

and its maximum time value may never exceed the attack time of the envelope, or the attack peak is gone.

Steffen Günther's icon

Awesome, thank you all! Somehow I thought messages to [line~] always need a start value but the case that you only need destination and duration is perfect.