Making my accordion a MIDI controller

Thanks for your reactions. I'll fiddle with the IIR filter. And the link is really useful. With respect to response, it needs to respond preferably within a couple of microseconds, less if possible. Starting from 10 to 20 ms you can notice latency when playing. But the midi controller is not the only object in the music chain.

Interesting idea the port expanders, I'll look into it.
Basically I have a light gate for every key. In the picture below from Wikipedia It woul place the light gate on the rod from the key to the pallet.

The side with all the buttons has a similar but more complex system. The buttons can represent chords and press multiple levers. Although there are 120 buttons there are less actual tones.

The accordion should still function as it does. And it will be a large circuit connecting all the keys. But the light gates are quite tiny so I plan to make small two sided pcb's each with one or two shift registers, the light gates and smd resistors were required. Looking forward making it.