So I picked up a 37 key (3 octave +1) toy keyboard from a local thrift store, and I want to add MIDI functionality to it. the matrix works out to be 5 grounds (labeled AB0-4) and 8 keys (labeled EF0-7). so for example the first note would be AB0 and EF0, making C2, and say AB4 and EF4 (C4) would be the last note on the actual keyboard (since there are only 37 keys and 40 notes)
What I need to know is how to loop through all of the inputs, and see which ones are connected, then send out the corresponding MIDI note.
I have female midi jacks that I can use and also some CD4051 multiplexers and a bunch of 595 shift registers available for use. I have used the shift registers before to control some LEDS, but as far as multiplexing inputs, i'm totally lost.
All my Arduino sketches are rudimentary., but I am using an Arduino Uno R3.