Try this:
http://forum.processing.org/topic/midi-in-processing