I like how nowhere in the documentation for line~ does it mention how to make a nice "start from a value on bang" volume ramp.
whatever trigger object -> message [1, 0 100] -> [line~] -> multiply that against whatever sound you want to fade out
took me uncomfortably long to figure that out
1 is the starting volume, 0 is the ending volume, 100 is how long the fade lasts.
Use vline~ for fancier stuff (so you can send a message like "1, 0.2 100, 0 200 100" which will do a sharp initial decay and a longer fade out -- the third param for vline is how long to wait to do the next item)
in fact, to prevent clicking, you'd probably do a volume ramp to full first
something like "1 4, 0 200 4" -> [vline~] would do the trick
it also took me uncomfortably long to figure out how to do a numeric counter (the one I have crosses the output from an int object with a + object, the output of which heads to the previous int object's input, the other argument to the + object is how much to add/subtract, and the output can be taken from the int object)
I made a nice tracker style keyboard playback thing with octave select so I can actually attempt to test how my patches sound musically without owning a midi keyboard.
have a gander if you want
Rename it to key-notes.pd and put it in the same folder as what you're working on, then hook in a key-notes object into whatever you're controlling. It emits midi note numbers and not frequencies, so use mtof to fix that.
The [ and ] keys select octave.