Page 1 of 1

Python MIDI I/O

Posted: Sun Jul 21, 2013 1:13 am
by Jeff Brown
I want to write a MIDI effect in Python -- something that can listen to my keyboard input, add a harmony*, and output both to Live. All my problems would be solved by a trivially simple piece of example code, one that just adds another note a halfstep up, or transposes its input an octave, or whatever. I could do the rest of it myself -- I can write basic Python but I'm failing to get a handle on MIDI input/output.

I installed PythonMIDI (https://github.com/vishnubob/python-midi/) and not even its own tests would run. I installed portmidizero to discover it requires portmidi; I tried installing portmidi and could not figure it out. I tried PyMIDI but it cannot output MIDI, only input it.

I expect processing the notes to be difficult enough. Does anybody know of an easy way to input and output them?

I use a Mac.

Re: Python MIDI I/O

Posted: Sun Jul 21, 2013 7:56 am
by phazed
Try to use

https://pypi.python.org/pypi/python-rtmidi/

It should be installable via pip as long as you have XCode on your machine. You may also want to have a look into the code of a small command line utility that i wrote using this library:

https://github.com/sourcebox/midiutil

Re: Python MIDI I/O

Posted: Sun Jul 21, 2013 3:42 pm
by Jeff Brown
Thank you so much. I hope to try this tonight.