Hi What,
Well, that's a bit of a problem. The trick is how [tabwrite~] works: when you bang it, it will start recording a signal to the table at the sample rate, and the table will show the signal once the its full. So in order to record a 1 second sound, you need a table of size 44100 samples (at least if that's your sample rate, which typically is), but it also means that for the next second the array will not show you anything (it's still recording during that period).
This means that you need to change the array size in order to fit the arriving signal. If you know how long a note lasts, that's trivial. But in the video above, the size of the notes is dynamic: if you hold the key of your input MIDI keyboard longer, the signal is longer, and there is no way to know in advance how long you will have it pressed down!
You can visualize only the attack, decay and sustain, but not the release... at least not in real time like that. But here is a trick if you simply just want to visualize stuff:
adsr-visualization.pd
Basically, the trick is that I don't send the same [vline~] to the array1: rather, I create a second envelope with a fake duration of 1s + release time (regardless of how long you hold the keyboard note). This way, you can see what is going on, although that is not a representation of the sound you are listening.
Does this make sense? Let me know if you need some help understanding this.
Cheers,
Gilberto