MIDI Keyboard Encoder - Arduino Piano/Keyboard (question)

sammyg:
To achieve step 3, you need matrix scanning code (which is what the Keypad library is). As a bonus, the way it is written eliminates the need for the diodes in your wiring diagram, hence the simpler

sammyg, you are correct that the diodes are not required for preventing shorts between keys on keypads and keyboards. But there is another problem called shadowing where some combinations of multiple keypresses will cause the keyboard driver to think that an extra key is being pressed when it is not. That would mean an extra note would be added to the chord. The solution is to place a diode across every key. All midi keyboards should already have the diodes but if op builds his own he should add them.