Miriam English wrote:
Did you want to attach a midi-capable instrument to your computer and use pygame to control it? Or did you just want to get sounds out, intending to use the built-in midi synthesizer to do it?
I want to use the built-in synthesizer. Here's what I've found out about the subject so far. On MacOSX, the pygame.midi module is a wrapper around CoreMidi, which provides a device-independent interface to whatever MIDI devices you have attached. Now, MacOSX has a software MIDI synthesizer built in, called DLSSynth, but it's *not* part of CoreMidi -- it lives in CoreAudio and has a different API. From googling, it appears that DLSSynth *used* to appear as a virtual device in CoreMidi, but that functionality was removed in MacOSX 10.6. (Aaargh, Apple, what were you thinking?) The result is that any application wanting to provide direct access to the software synthesizer now has to treat it as a special case. The other approach is to use an external application that functions as a virtual MIDI synthesizer. I've found one called SimpleSynth that is essentially a wrapper around DLSSynth. With SimpleSynth running, a virtual MIDI device appears that I can open with pygame.midi, and all works well. So I've found a solution, on MacOSX at least. However, it's a bit disappointing that I have to rely on an external program instead of being able to make the whole thing self-contained. It will make it more difficult for other people to use my application, especially on Linux and Windows where I'm not sure what advice to give them.
Sox is a free, open source, cross-platform program that processes and generates sounds. Most people think it's only a sound player or format converter that can work on almost any sound file format in existence, but it can also synthesize sounds.
Thanks for the pointer, looks like it has interesting possibilities. Can Sox be used as a library called directly from Python? Or would I have to run it as a separate process and pipe stuff to it? -- Greg
