I want to stop "note off" messages if at least one of the MIDI keys was not released. Or to put in other words I need to activate "note off" messages only if the key released was the only pressed. If there are at least two keys pressed, no "note off" messages should be sent. I think this is doable, because "note off" goes after "note on". So maybe I should count "note on" messages or. . .?
The only MIDI key released
yes, you can definitely patch this up.
will you want to queue note offs so that all notes release eventually, or should notes hang after at least two are pressed and then released?
a 128 position array can keep track of which notes are held. you can use a note counter and once it reaches 0, send note offs for each note the array recorded.
you may also want to look at the help file for [bag ]. you can flush it when the note counter reaches 0. i am nervous about using [bag ] for reasons i don't remember.
This post is deleted!
@Transcend Another attempt: This stores the notes in an array as @LarsXI proposed. Note on events are recorded with the value 2. Note off events set the value to 1. After each note off event, the maximum of the array is checked. If it is 1 (only note offs), all note offs are released: holdnotes.pd
Edit: Maybe a little more elegant: holdnotes.pd
At first glance [bag] seems promising, but I didn't find it useful, probably of "do nothing" when no values are stored.
Even if poly works I found Arrays more simple. Yes, Max or Sum of array does the same job - when "zero value" is detected it bangs. That's it!