Collect held notes and reorder them
Hi, I want to keep track of the currently held midi notes, and, with an external trigger, randomly play some of them.
I managed to collect the held notes in a <coll>, but for some reason, I struggle to gather them in another <coll> that would simply reorder the indexes from 1.
Any help ?
Max Patch
Copy patch and select New From Clipboard in Max.
I think I found a solution. Posting here in case it helps.
Max Patch
Copy patch and select New From Clipboard in Max.
this can sort and renumber in one go.

do you flush externally played notes when they
get released from the coll ?
Thanks !
Here's the final patch for those who are interested. The idea is to use currently held notes as a 'reservoir' of notes. These notes are triggered randomly by any of the 4 highest notes (because who ever play these notes ?)
Max Patch
Copy patch and select New From Clipboard in Max.