[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] Mac OS X MIDI support success (MacPorts)
Some people here on the list seemed to have had problems getting MIDI to
compile / work on Mac OS X with the latest pygame.
I'm not sure which was the OS X version in question, but I have
successfully compiled pygame from mercurial with MIDI support under OS X
10.6 and Python 2.7 from MacPorts.
I ran into a small problem with the configure script "config_darwin.py".
At first it was telling me "Framework CoreMidi not found". A look
through my ../Libraries folders told me that the name of the framework
is wrong in the script: it's "CoreMIDI" not "CoreMidi".
This won't bite most users because by default the OS X filesystem is
case-insensitive but mine isn't. This should be fixed.
I have written up my notes on compiling PyGame on OS X and attached a
patch for config_darwin.py here:
http://trac.chrisarndt.de/code/wiki/PyGame
As you can see there, there are a few other issues with compiling on OS
X but they don't concern MIDI, so I'll write about them in another post.
Here's a simple test I conducted to confirm that MIDi output works (I
used fluidsynth as the tone genarator):
Python 2.7.2 (default, Feb 22 2012, 11:42:14)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
from pygame import midi
midi.init()
for i in xrange(midi.get_count()):
... print midi.get_device_info(i)
...
('CoreMIDI', 'Netzwerk Session 1', 1, 0, 0)
('CoreMIDI', 'Netzwerk Session 1', 0, 1, 0)
('CoreMIDI', 'FluidSynth virtual port 2819', 0, 1, 0)
>>> import time
o = midi.Output(2)
>>> o.set_instrument(40)
for n in (72, 76, 79):
... o.note_on(n, 100)
... time.sleep(.5)
... o.note_off(n)
... plays a broken C-major chord with strings.
Chris