Python Control of VMeter USB MIDI Device via PyPortMIDI and MidiPort
This tutorial will show how to setup pyMidiPort on OS X to control the VMeter USB MIDI device with python scripts. Using the new sysex commands in the latest VMeter firmware (1.8, only on hardware rev B+), you can control every single LED directly (not just columns as with MIDI Controller messages).
Check out the video demo here: Binary Clock, Chase, Treadmill, Game of Life via Individual LED control of VMeter.
Warning: installing pyPortMidi may require a bit of installation judo and trial & error. It may take 5 min., but it took us 2 days! If you know other software for MIDI and python let us know! PyGame was a deadend for us.
Instructions are based on OS X 10.8.2 Mountain Lion. Most of these instructions were gleaned from http://cratel.wichita.edu/cratel/cratel%20pyportmidi#build_on_OS_X.
You may also need to install XCode command line tools.
- Install homebrew and run "brew doctor" to make sure everything is ok.
- Install portmidi (installing portmidi from source failed for us).
- Use homebrew to install portmidi: brew install portmidi
- We got the error "Warning: Could not link portmidi. Unlinking...", and had to then run "brew link --overwrite portmidi"
- Download PyRex ver 0.9.6.4. Other versions may work, but they're untested.
- Change line 21 of Pyrex/Mac/DarwinSystem.py to: os.environ["MACOSX_DEPLOYMENT_TARGET"] = "10.6"
- Build and install Pyrex: sudo python setup.py install
- Download PyPortMidi (ver 0.0.3)
- replace portmidi.h, porttime.h with the files from the installed portmidi. In my case, these were located in /usr/local/Cellar/portmidi/200/include/
- Copy libportmidi.dylib from the installed portmidi to the OSX directory in pyPortMidi-0.0.3. In my case, this was located in /usr/local/Cellar/portmidi/200/lib/
- Change line 357 of pypm.pyx to
while(Pm_Poll(self.midi) != pmNoError):
- Run the pyPortMidi build: sudo python setup.py install
- Plug in a USB Midi device and run the test: python test.py
Good luck!