You should break the problem down into component parts. There are clearly 2 things that you need to do:
-
Read a button and register that this has changed from OFF to ON. There is plenty of example code on how to do this. You should consider debouncing the switch so that you do not read false presses (sounds like you have not from the description).
-
Sending the note to the MIDI device. Again, lots of examples on how to do this (look for MIDI in the Playground) using various libraries trhat will do most of the work for you.
The easiest way to learn is to try writing some simple code from existing examples and then asking for more help when you get stuck.