Using MIDI devices in Blender 2.93

Anyone have a solution for using MIDI devices in Blender 2.93 or above?
I’m looking to use various devices with buttons and faders that support note and CC messages to control parameters in realtime and write keyframes.

I tried contacting the creator of AddRoutes about an update but never got a response.

I had some promising attempts using/installing the python-rtmidi module.
You can either read the buffer via callbacks or by polling.

The module is in python, so you have to write scripts. To use it more convenient it is also possible to create / develop nodes in animation nodes that provide a graphical usage.

Here is an extract of a sample code from python-rtmidi that prints the midi messages to the blender system console:

from rtmidi.midiutil import open_midiinput

port = sys.argv[1] if len(sys.argv) > 1 else None

midiin, port_name = open_midiinput(port)
except (EOFError, KeyboardInterrupt):
print(“Entering main loop. Press Control-C to exit.”)
timer = time.time()
while True:
msg = midiin.get_message()

    if msg:
        message, deltatime = msg
        timer += deltatime
        print("[%s] @%0.6f %r" % (port_name, timer, message))


except KeyboardInterrupt:

del midiin

Keep in mind that there also is a “rtmidi” module it might also work, but I used “python-rtmidi”.

Hope you can use it.

Thanks for the reply. I just found that there’s a new version of AddRoutes for 2.93. AddRoutes also uses rtmidi.