Python中的跨平台音频播放

时间:2022-12-24 12:15:43

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?

是否有可用于音频播放的跨平台Python库?我定位的操作系统(按重要性排序)是Windows,Linux和Mac OSX。需要支持的文件格式(按重要性顺序)为MP3,OGG,WAV和FLAC。这样的事情存在吗?

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.

我已经尝试了一些可用的Python库,如Snack,PyMedia,PyGame等。我无法让PyMedia编译,Snack不会播放音频,PyGame也不会播放音频。我在Linux上:Ubuntu 9.10。

3 个解决方案

#1


2  

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

gstreamer是多平台的。它可在Linux,PPC,ARM,x86和SPARC,MacOSX,Microsoft Windows,IBM OS / 400和Symbian OS上运行。

#2


1  

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.

对于你想要的东西来说,这可能有些过分,但我对PyAudiere库有很好的经验。我已经让它在Windows和Linux上运行没有问题,但我还没有在OSX上测试它。

#3


1  

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;-).

Python维基上的音乐页面列出了许多可能性 - 实际上它的目的是详尽无遗(你可以编辑它来添加它缺少的东西;-)。我对绝大多数这些工具和库没有直接经验,但至少从列表中可以看出,许多人声称至少支持MP3和OGG(较少明确提及WAV或FLAC ;-)。

#1


2  

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

gstreamer是多平台的。它可在Linux,PPC,ARM,x86和SPARC,MacOSX,Microsoft Windows,IBM OS / 400和Symbian OS上运行。

#2


1  

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.

对于你想要的东西来说,这可能有些过分,但我对PyAudiere库有很好的经验。我已经让它在Windows和Linux上运行没有问题,但我还没有在OSX上测试它。

#3


1  

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;-).

Python维基上的音乐页面列出了许多可能性 - 实际上它的目的是详尽无遗(你可以编辑它来添加它缺少的东西;-)。我对绝大多数这些工具和库没有直接经验,但至少从列表中可以看出,许多人声称至少支持MP3和OGG(较少明确提及WAV或FLAC ;-)。