We are guessing without your complete code and a schematic of your keyboard. There are several issues to be considered when designing a [switch matrix][1] for an embedded processor regardless if it is a musical or computer keyboard: 1. [Contact bounce][2]: This is more important for a computer keyboard then a musical keyboard. However if the switch are particularly bad, it may audible. Software may be used to mitigate the problem but will also add delay between the key press and the beginning of the note's sound. 2. [Pull Ups][3]: Any logic input should not be left unconnected or floating. This can lead to unexpected results. Use Pull Up resistors (or Pull Down depending on your design) to mitigate this problem. The [Arduino Uno's][4] embedded processor ([the ATmega328P][5]) comes with built in Pull Up resistors. The Arduino IDE abstracts this feature by including a parameter it the [pinMode() function][6] call to invoke this feature. 3. [Rollover][7]: In a switch matrix of m rows and n columns a single switch closure can be uniquely detected. However, if two switch closures occur in the same row or column, they can not be uniquely detected. This is because current can flow through both closed switches activating both rows or both columns nullifying the ability for the embedded processor to scan individual rows or columns. To mitigate this problem a diode is added to all switches in the switch matrix such that there is no current path between rows or columns. From the [Rollover wikipedia page][8]: > Most music keyboards use isolation diodes in their keyboard matrix to > implement full n-key rollover, making them immune to both key ghosting > and key jamming This image if from [this stack exchange question][9]: [![This image is from [this stack exchange question][8].][10]][10] [1]: https://en.wikipedia.org/wiki/Keyboard_matrix_circuit [2]: https://en.wikipedia.org/wiki/Switch#Contact_bounce [3]: https://en.wikipedia.org/wiki/Pull-up_resistor [4]: https://store.arduino.cc/usa/arduino-uno-rev3 [5]: http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7810-Automotive-Microcontrollers-ATmega328P_Datasheet.pdf [6]: https://www.arduino.cc/reference/en/language/functions/digital-io/pinmode/ [7]: https://en.wikipedia.org/wiki/Rollover_(key) [8]: https://en.wikipedia.org/wiki/Rollover_(key)#n-key_rollover [9]: https://arduino.stackexchange.com/questions/31885/need-help-in-circuit-diagram-of-88-reed-switch-matrix [10]: https://i.sstatic.net/76A84.jpg