Skip to main content

MIDI Forum

Keyboard matrix sca...
 
Notifications
Clear all

Keyboard matrix scan

2 Posts
2 Users
0 Reactions
32 Views
Christoph
Posts: 40
Trusted Member
Topic starter
 

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.


 
Posted : 27/03/2026 7:17 am
Jason
Posts: 485
Honorable Member
 

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

https://stackoverflow.com/questions/59472548/how-to-detect-the-release-of-a-switch-in-a-keyboard-matrix-using-a-microcontroll

I didn't find anything specifically related to MIDI, but the general ideas carry over.


 
Posted : 27/03/2026 9:00 pm
Share: