使用 Python 播放 MP3 文件

发布于 2024-08-13 01:40:22 字数 187 浏览 7 评论 0原文

我正在尝试编写自己的媒体播放器(如 Foobar),但在查找可以播放 MP3 的 Python 库时遇到了困难。我知道 Pymedia 可以播放 mp3,但它看起来已经过时了 - 最新的安装程序适用于 Python 版本 2.4,而我正在使用 2.6。我从来没有在 Pygame 上取得过太大的成功,而且 Pyglet 看起来也没有太多的文档。还有其他选择吗?

I'm trying to write my own media player (like Foobar), and I'm having trouble tracking down a Python library that'll play MP3s. I know Pymedia does mp3s, but it looks outdated - the latest installer is for Python version 2.4, and I'm using 2.6. I've never had much success with Pygame, and Pyglet doesn't look like it has too much in the way of documentation. Are there any other alternatives?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

明媚殇 2024-08-20 01:40:22

http://pyglet.org/ 并且您也尝试过http://code.google.com/p/mp3play/?它也可以从 PyPi 获得(http://pypi.python.org/pypi/mp3play/) 但是,我认为 mp3play 目前只是 Win32。

查看更新,过去几个月内有一些提交。

There is http://pyglet.org/ and also have you tried http://code.google.com/p/mp3play/? It's also available from PyPi (http://pypi.python.org/pypi/mp3play/) However, I think mp3play is Win32 only for now.

Looking at the updates, there were commits within last couple of months.

此生挚爱伱 2024-08-20 01:40:22

我已经在 Windows 上的 Python 2.6.5 中成功使用了 PyMedia。注意事项:文档很糟糕并且是错误的——许多教程都有明显的错误或无法工作——所以我必须做一些实验和谷歌搜索才能让我的代码正常工作。此外,无论出于何种原因,维护人员似乎在 4 年前就停止了更新项目站点,尽管他们似乎正在积极做一些事情。

我在这里找到了安装程序:
http://www.lfd.uci.edu/~gohlke/pythonlibs/

从他们的网站链接的半活跃论坛包括一些半有帮助的代码维护者。如果有人正在寻找建议,我是 jboyd99。

由于我无法理解的原因,重点是汽车音频系统,尽管事实上它是一个功能相当齐全的库,可以完成其他免费 Python 库无法完成的一些操作,例如将 MP3 读取到原始 PCM 数据中。该库有一些缺陷——我可能会使用 PyAudio 或 PyAudiere 进行实际播放,以便更好地控制同步问题。

I've been using PyMedia in Python 2.6.5 on Windows successfully. Caveats: the documentation is bad and wrong -- many of the tutorials have glaring errors or otherwise don't work -- so I had to do some experimentation and Googling to get my code to work right. Also for whatever reason the maintainers seem to have stopped updating the project site 4 years ago, though they seem to be actively doing something.

I found installers here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/

The semi-active forum linked from their website includes some code maintainers who are semi-helpful. I'm jboyd99 if anyone is looking for tips.

For reasons that are beyond me the focus is on car audio systems, despite the fact that it is a fairly fully featured library that does some things no other free Python library does, like read MP3s into raw PCM data. The library has some flaws -- I'll probably use PyAudio or PyAudiere for actual playback for better control of synchrony issues.

半山落雨半山空 2024-08-20 01:40:22

也许用 Python 2.4 编写应用程序的这一部分作为单独的“后端”会更简单。这样你就可以使用 PyMedia (http://pymedia.org/) (正如你所提到的)进行实际播放。它允许您用另一个 Python 版本(如 2.6)编写 GUI,这也意味着程序组件和并行性的更多解耦(更平滑的 GUI)。

如果您仅针对 Windows 平台,则通过 COM 使用 Media Player 可能会有所帮助:

http://www .daniweb.com/code/snippet216465.html

Maybe it'd be simpler to write that part of your application in Python 2.4 as a separate "backend". This way you could use PyMedia (http://pymedia.org/) (as you mentioned) for the actual playback. It'd allow you to write your GUI in another Python version (like 2.6), which would also mean more decoupling of program components and parallelism (smoother GUI).

If you target only the Windows platform, then using Media Player via COM might help:

http://www.daniweb.com/code/snippet216465.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文