pyrtmidi updates

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!

By | 2010-09-21T16:57:00+00:00 September 21st, 2010|Uncategorized|1 Comment

One Comment

  1. Yanone September 26, 2010 at 6:06 pm - Reply

    dear patrick,

    you are about to save my life, as you are the only one who has an easy to use midi library for python that i got installed on my mac.
    however, unfortunately it doesn’t really work either.

    calling openPort with blocking set to true doesn’t work; the funtion will only take one argument, presumably the port ID.
    this way, no messages are received:

    print midiin.getMessage()
    rtmidi.RtError: no messages available

    i understand from your post that you changed stuff. i’m looking at it for the first time, and am unsure whether that has to do with my problem. i would extremely appreciate a response. you can catch me at post at yanone dot de

    cheers from the netherlands,
    jan

Leave A Comment

− 1 = 1