Is there a general keyboard matrix scan program available somewhere that can be taken as a foundation for further development.
Some kind of foundation to build upon?
Taking debouncing aside and velocity, a diode matrix scan of 4 rows by 8 columns requires some logic to maintain the pressed notes, that is, once the key event occurs, the note got to be played. Some bookkeeping has to be made, reflecting the fact that it has to be remembered that it had been played. As soon as it disappears from the scan balance, it got to be muted and taken out of the momentarily active notes. etc. etc.
Is this bookkeeping algorithm available somewhere? I'm aware, that reflecting velocity adds some level of complexity.
First I've heard of it, but it's a cool concept.
I found this "circuit python" implementation. I'm sure there are plenty of others in different languages out there.
https://learn.adafruit.com/key-pad-matrix-scanning-in-circuitpython/keymatrix
Another pseudo-method
I didn't find anything specifically related to MIDI, but the general ideas carry over.