-3

I need to create a pair of midi devices in Python. The idea is that I can patch the output of a MIDI device into my script, and patch the output of my script into something like SoftSynth. My script would make modifications to the MIDI Stream as they passed through.

I know it's almost certainly possible, but I can't seem to find a "batteries included" solution.

Lewis Eason
  • 304
  • 2
  • 11
  • Well I haven't found any solutions that'll do it for me, and I'm not competent enough to do it from scratch, so, nothing so far. – Lewis Eason Dec 11 '12 at 01:14
  • Have you tried using `pygame`? –  Dec 11 '12 at 01:15
  • My understanding was that `pygame` could connect to midi devices. What I need to do is make my script appear as a midi device. So with `pygame`, you specify which device you want. I'd rather that was done centrally, with aconnect or patchage. – Lewis Eason Dec 11 '12 at 01:19

1 Answers1

0

There is no built-in MIDI library in Python, largely because there is no cross-platform notion of "MIDI device". Or, rather, there are about 30 different ones—PortMedia, JACK, SDL, etc.

So, you have to pick one. If this is for personal use, pick the one you're actually using right now to connect things up. It doesn't matter whether it's cross-platform or not; whether you're using ALSA or PortMedia for MIDI, use a wrapper for that.

So, how do you find a wrapper? Just go to PyPI and search for "alsa" or "portmedia" or whatever, possibly together with "midi", and there's a good chance you'll find a decent wrapper. (This should be your first step whenever you're looking for libraries to do X in Python if X isn't built in.)

abarnert
  • 354,177
  • 51
  • 601
  • 671