[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] "game" idea (sound output)

On 03.09.2011 02:47, Greg Ewing wrote:
> 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.

On Windows there's always the GM Wavetable synth available as a Midi
device, which can be used through portmidi (pygame.midi).

On Linux users can run fluidsynth or timidity and load a GM soundfont
(sf2) to provide similar capabilities. At least on Debian-based
distributions this is just a matter of installing the "timidity-daemon"
and the "fluid-soundfont-gm" packages and making sure that
/etc/init.d/timidity is started. Timidity will then provide four virtual
midi outputs with a GM compatible software synth.

>>> from pygame import midi
>>> interfaces = [midi.get_device_info(n)
       for n in range(midi.get_count())]
>>> interfaces
[('ALSA', 'Midi Through Port-0', 0, 1, 0),
 ('ALSA', 'Midi Through Port-0', 1, 0, 0),
 ('ALSA', 'TiMidity port 0', 0, 1, 0),
 ('ALSA', 'TiMidity port 1', 0, 1, 0),
 ('ALSA', 'TiMidity port 2', 0, 1, 0),
 ('ALSA', 'TiMidity port 3', 0, 1, 0)]

HTH, Chris