This is part of the schematic of the Roland A49 MIDI controller:
This is the connector that makes the connection between the keyboard and the main board. PR0-7 and SC0-7 are scan signals, the program iterates through them (applies a voltage to one pin at the time) and reads T0-7 to see which keys are being pressed. On the keyboard side, its a simple switch network.
I drew the complete circuit for one key:
The 100 Ohm resistors I can understand as overcurrent protection in case the GPIO pins are configured both as outputs.
But what is the case with the caps? What do they do?