You could combine this last one with the first one i posted: Use the bang from the envelope follower and then use the toggle thing from first post to turn the adsr envelope on/off.
Ps I think i turned the < the wrong way. I think it should be > But also depends how one wants it to work.
One thing I also wonder with envelopes is how to get rid of hanging notes… On the miller adsr if you trigger the envelope again, before the last note has ended, it can sometimes lead to hanging notes. I think I need to edit it a bit. I think there is an examplein the pd examples that shoe how to get and envelope that is reset fully on every hit. It can be pretty problematic with hanging notes in the middle of a live session. Anyway, will figure it out eventually.