0

I'm looking for a simple library to play MIDI songs in a simple game I'm (trying) to make. Does anyone know of one I could use?

I found pygame but found it far too complicated.

(I've only been programming in Python (or at all) for 13 weeks).

Aaron
  • 151
  • 2
  • 2
  • 7
  • 3
    See related question http://stackoverflow.com/questions/6030087/play-midi-files-in-python. – Mihai8 Jun 09 '13 at 12:28
  • As stated, PyGame is too difficult. I was after something easier? – Aaron Jun 09 '13 at 12:36
  • @Nate It's not likely you'll find anything else. – Patashu Jun 09 '13 at 13:11
  • 1
    Actually, there are plenty of options out there… but first you have to tell us what platform you care about. Or, if you want to be cross-platform, what audio wrapper library you're willing to require (PortAudio, JACK, etc.). – abarnert Jun 09 '13 at 14:37
  • It would just have to run on OS X. – Aaron Jun 09 '13 at 14:44
  • However, none of them are going to be as easy as "play this song". Generally, you're going to need to set up an output connected to the default synth, then open and iterate over the MIDI file, and send MIDI events to the output with the right timing. See [this example](https://github.com/vishnubob/python-midi#using-the-alsa-sequencer) of the latter part; does it look too hard? – abarnert Jun 09 '13 at 14:45
  • 1
    For just OS X, the easiest thing to do is probably to use the built-in CoreAudio/CoreMIDI stuff through pyobjc. Let me see if I can find an example, then I'll write up an answer. – abarnert Jun 09 '13 at 14:46
  • Actually, strike that… I just found my old code that does this, and… I had to write a bunch of simple ObjC wrappers around CoreAudio and CoreMIDI before I could access anything from Python. Others have used SWIG or Pyrex/Cython for the same purpose. But I'm for guessing anyone who finds pygame too difficult, none of those are options. So, let me look some more. – abarnert Jun 09 '13 at 14:55
  • Alternatively, how would I use PyGame to play a simple midi in the background? I cannot run the setup.py and the machine I will making the game on won't be the one I play it on, so I cannot 'install' pygame on this other computer. – Aaron Jun 10 '13 at 02:46

0 Answers0