Mega MIDI Keyboard jittery noise (interference)

Please read this:-
How to use this forum
Because your post is breaking the rules about posting code. Not only that you are having your code mangled by the forum software and turning it in to italics.

What I notice about your code is that you seem to be using arrays and not using any index, just the array name.

Also you seem to be turning a note on or turning a note on, so that is not going to work.
You need to send the note on only when your switch becomes on for for the first time. Likewise when your switch is off for the first time then send a MIDI note off message.

Look at the IDE at the "state change" example to see how to detect what a switch changes, do not simply look at the switch state. Remember you loop will run perhaps 1000 time a second, which with the code you have going to cause all sorts of trouble flooding the MIDI sound generator all sorts of problems.