I'm working on a MIDI guitar project for disabled musicians that can apply chord changes to a stream of played MIDI notes that correspond to the 6 open strings on a guitar. So, from my Bela based guitar I get only 6 notes (64 59 55 50 45 40) on 6 channels (2 to 7) along with the velocities, and those notes get transposed to the correct values based on a selected chord. When the string vibration drops below a threshold on the Bela based guitar, it sends the corresponding note with a zero velocity.
This all works fine, but I get stuck notes if a note is playing and there is a chord change before the notes are finished. I need to somehow track the notes that are playing so that when a new note comes in to a particular channel, it will send a zero velocity note to the previous value for that channel. I've been hammering away trying to figure this out all day and getting nowhere. I'm not the poly object helps here because I need to keep track of the notes by channel number rather than the arbitrary voice number of poly.
I've been trying to build up and tear down lists on the fly but it is messy and glitchy.
Any recommendations on tracking notes/channels so I can handle the notes off properly?