views:

96

answers:

3

Is there a cross-platform Python library for audio playback available? The operating systems I am targeting are (in order of importance) Windows, Linux, and Mac OSX. The file formats which need to be supported are (in order of importance) MP3, OGG, WAV, and FLAC. Does something like this exist?

I have tried a few of the Python libraries available such as Snack, PyMedia, PyGame, etc. I couldn't get PyMedia to compile, Snack wouldn't play audio, and PyGame wouldn't play audio either. I'm on Linux: Ubuntu 9.10.

+1  A: 

It's probably overkill for what you want, but I've had good experience with the PyAudiere library. I've had it working on Windows and Linux without trouble, but I haven't tested it on OSX yet.

Mark Rushakoff
Unfortunately I can't even open up my audio device using it. I just compiled and installed PyAudiere and the only sound device it's showing on my machine is "OSS" and it can't open OSS.
TK Kocheran
@rfk: Is it possible that you just have some uncommon, poorly supported sound card? It's very strange that *none* of the generally well-supported libraries are working on your system.
Mark Rushakoff
+1  A: 

The music page at the Python wiki lists many possibilities -- indeed it's intended to be exhaustive (you can edit it to add something that it's missing;-). I don't have direct experience with the vast majority of these tools and library, but at least from the list it seems that many claim to support at least MP3 and OGG (fewer explicitly mention WAV or FLAC;-).

Alex Martelli
A: 

gstreamer is multiplatform. It runs on Linux, PPC, ARM, Solaris on x86 and SPARC, MacOSX, Microsoft Windows, IBM OS/400 and Symbian OS.

nosklo