MIDI stands for Musical Instrument Digital Interface. Messages are transferred over a serial protocol (based on UART, configured to 31250 8-N-1). The basics are described in Electrical Specification for MIDI, Tom Igoe's - MIDI Communication, and Arduino Tutorial.

MIDI Pin Layout

Pin # MIDI IN MIDI OUT / THRU
3    
5 IN- IN
2   Shield
4 IN+ +5v
1    

MIDI Out

MIDI In

Programming Resources