pyrtmidi is a simple python extension to RtMidi, an awesome three-file C++ library that allows you to read and write midi messages from hardware on all platforms. It’s awesome.

I’ve been updating the module lately with major api changes. It replaces those inane tuple midi objects with a comprehensive MidiMessage class ripped from the juce library that includes great functions like isNoteOn(), isNoteOff(), isController(), getNoteNumber(), getMidiNoteName(), setTimeStamp(), etc. That means that pyrtmidi is now a real midi io library. Both input and output works, but virtual ports are untested, and I also updated RtMidi to the latest version.

However, as of last night I removed the platform-specific code to support a blocking version of RtMidiIn.getMessage(), and RtMidiIn.setCallback() works exactly as documented in the C++ RtMidi docs which means that the callable object is called from the midi thread. I’ll re-add the blocking getMessage() between builds at work asap since I think that’s the nicest feature in the module. You should be able to use a Queue.Queue (blocking queue in the stdlib) to get around this for now.

http://trac2.assembla.com/pkaudio/wiki/pyrtmidi

Have Fun!