pygame.midi -- midi in, and midi out.

I started adding more midi support to pygame.

Pygame can already play midi files, however it can not get midi input, or send midi output to devices.

Nicholas played around with some midi stuff in our eye stabs computer game... where it turned notes from a real guitar using pitch detection into midi events. This experiment used portmidi, and it seems to work ok in a cross platform manner.

I hooked up my USB midi controller, and am able to get midi events!

I've also added some code which converts the midi events into pygame events, and posts them to the normal pygame event queue. This simplifies things for people already used to handling events with pygame (like mouse, keyboard, and joystick events).

I can also get it to write to midi outputs, but haven't really got a use for that yet. However I would like to hook it up to my casio keyboard to get some retro sounds out of it... but I have no midi output converter anymore. It is possible to get USB->midi converters fairly cheaply these days.

Anyway... it should be possible to write a joystick->midi program, a web cam->midi, and all sorts of other fun things with this. There's lots of music devices out there that talk midi, so this should be quite fun!

Hopefully it'll make it into the next release of pygame -- pygame 1.9, and of course into pygame reloaded (think py3k for pygame).


Blake Miller said…

Where is it?
illume said…

It's in pygame svn now as pygame.midi

There's some examples in examples/

However it still needs work finishing it off documentation, tests, and implementing a few features.
Kurtis said…
i was just checking this out last night and i must say, you are a blessing. This is awesome.

I've been trying to get midi input from my Axiom-49 for some time now and you provided me with exactly that. Is there a central place for any documentation? The documentation that came with pygame SVN doesn't have anything in it for pygame.midi and I'm not sure how to trigger certain things. Please let me know where I can learn more about pygame.midi!
illume said…
Hi Kurtis,

the documentation and tests will come 'soon'... they're up high on my todo list (maybe this weekend).

However for now, you can look at the examples/ It has a midi input, and an output example in there. There's also a few doc strings in the midi module... so help(pygame.midi) will show you stuff.

Please let me know how you go, and also if you spot any bugs.

I'm really enjoying my axiom 25... but sometimes I wish I got the axiom-49 with all its sliders and stuff :)


Popular posts from this blog

Is PostgreSQL good enough?

Hey! It's work on pygame stuff week.

pygame on pypy usable