简体   繁体   English

Python中的跨平台音频播放

[英]Cross-platform Audio Playback in Python

Is there a cross-platform Python library for audio playback available? 是否有可用于音频播放的跨平台Python库? The operating systems I am targeting are (in order of importance) Windows, Linux, and Mac OSX. 我所针对的操作系统(按重要性排序)是Windows,Linux和Mac OSX。 The file formats which need to be supported are (in order of importance) MP3, OGG, WAV, and FLAC. 需要支持的文件格式(按重要性顺序)为MP3,OGG,WAV和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. 我已经尝试了一些可用的Python库,如Snack,PyMedia,PyGame等。我无法让PyMedia编译,Snack不会播放音频,PyGame也不会播放音频。 I'm on Linux: Ubuntu 9.10. 我在Linux上:Ubuntu 9.10。

gstreamer is multiplatform. gstreamer是多平台的。 It runs on Linux, PPC, ARM, Solaris on x86 and SPARC, MacOSX, Microsoft Windows, IBM OS/400 and Symbian OS. 它运行在Linux,PPC,ARM,x86上的Solaris和SPARC,MacOSX,Microsoft Windows,IBM OS / 400和Symbian OS上。

It's probably overkill for what you want, but I've had good experience with the PyAudiere library. 这对你想要的东西来说可能有些过分,但我对PyAudiere库有很好的经验。 I've had it working on Windows and Linux without trouble, but I haven't tested it on OSX yet. 我已经让它在Windows和Linux上运行没有问题,但我还没有在OSX上测试它。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM