This Add-on let you send or receive MIDI informations in real-time in the Blender viewport. The MIDI events can be routed to any properties of your choice.
All theses settings are stored in the Blend file and are not scene dependent. Note that the update rate parameter needs a Stop/Start cycle to be taken in account.
AddMIDI relies on Keying Sets as a way to easily select and import properties that will be bridged toward the external wold, but you can use directly the text editor to create more complete lists of MIDI items, with their respective settings (see below).
This is an example of a list containing 3 items.
Choose one of the two methods:
If you want to work on the developpment of the Addon or prefer to have a system wide installation of this Add-on, you need:
Read this page that explains all.
Python-Rtmidi has reached version 1.1 and you can grab the sources or binary modules from this page.
For the sources version: unpack the archive somewhere and read carefully the instructions. You will have to install Cython with pip (which in turn may require a compiler to be installed on the system) if not done already.
Depending of your OS you might as well find some binary modules for python-rtmidi in the download section. They are in whl format.
When you invoke Python to install this module, use of course "python3.x" located in the bin dir of your full Python installation mentionned in my page above and the module will be installed right in the good place (you can check that with 'pip list' even though it was not installed with it).
You should be ready now to install it. This is the most easiest part actually.
Grab the Add-on from my Github page (Download ZIP on the right), then install and enable it through the Blender User Preferences screen...
Right now AddMIDI doesn't provide by itself any form of MIDI synchronization with a sequencer for instance. Fortunately on Linux (and OSX and may be even Windows) Blender can use the JACK protocol. Set Blender to use JACK in the user preferences and choose 'AV-Sync' in the Timeline Screen, that will work perfectly if of course you use a JACK aware sequencer like Ardour or Muse2, or any other. Start, stop, and moving the playhead will reflect on both softwares.
Controlling properties is nice but what if you want to control Blender directly (i.e, accessing bpy.ops) ? AddMIDI doesn't allow this directly but there is a trick used in this example to bypass this limitation.
When you create a property using Python in a script you can set an update function. Each time your property will change this function will be called. It is then very easy to write whatever you want in this update function.
The example here is no less than a real-time polyphonic synthesizer based on this principle.
Note: when you load this file, the python script needs to be executed at least once. I enabled the "Register" option as you can see on the screenshot. But Blender won't nonetheless execute it without your consent, to protect user from untrusted scripts. You will have either to click "Reload Trusted" in the top bar or click "Run Script" manually. If not the 2 properties (with their update function) won't be created.
There is a thread about this Add-on on the BlenderArtists.org forum.