MIDI and Multiplexing

Hello everyone.

I'm working on a project to convert an old pipe organ console to use MIDI for the sake of controlling virtual instruments.

I'm planning on using three Arduino Mega 2560 units to turn digital switch information into MIDI notes.

There are two keyboards with 61 notes, and a pedal board with 32 notes.

I want to achieve 16+ note polyphony (polyphony = the ability to input more than one note at a time) across all of the keys of the two keyboards, and the pedal board shouldn't be an issue because the Arduino Mega 2560 has 54 digital inputs.

With 61 switches needing to be condensed into 54 inputs, I need to use a multiplexer or two.

I'm thinking of using either two 8:1 multiplexers or one 16:1 multiplexer per keyboard, but I don't know how either option will affect my polyphony needs. Does coding a keyboard matrix solve this?

Do I need to use additional arduinos instead?

Multiplexers and programming a keyboard matrix are beyond what I was taught in my basic electronics and circuits course in college.

Can anyone help me figure this out?

I've never looked closely at the Mega. Are you aware that the analog inputs can be used as digital inputs as well? Not sure if they are counted in the 54 that you mention.

I'm planning on using three Arduino Mega 2560 units to turn digital switch information into MIDI notes.

Bad idea, typical of beginners. Using more than one Arduino simply to get more output pins is stupid. Just use shift registers or port expanders.

Now in what form are these keyboards / switches? That will determine your best solution.

There are two keyboards with 61 notes

61 for each keyboard, so 122 in total, or 30/31 per keyboard so 61 in total?

But have you got 61 actual keys to monitor? I very much doubt this because that is not the way music keyboards are made.