编程语言
首页 > 编程语言> > 我正在寻找可以播放MP3和OGG并支持ALSA或类似功能的跨平台Python库.

我正在寻找可以播放MP3和OGG并支持ALSA或类似功能的跨平台Python库.

作者:互联网

有几种不同的音频库,但是它们都不满足我的确切需求:
-它必须是跨平台的.
-它必须能够在Linux下使用ALSA,PulseAudio或任何其他常见的默认混音器.
-它必须能够自动检测采样频率.
-它必须(相当)简单地使用,如果有人可以给我一个额外的脚本,使我更容易接受的话.
-我唯一需要的功能是播放/暂停,搜索是一项不错的奖励.
-它需要能够播放MP3和OGG.没有其他格式对我很重要.

到目前为止,我尝试过的库:
PyGame-不支持检测歌曲的频率
PyAudiere-很有前途,但仅在Linux上加载OSS,与此同时我遇到了严重的混合问题
内置模块-据我所知,不支持MP3和OGG
PyMedia-很有前途,但复杂.也无法找出它使用了什么混合设备.
PySonic-依赖于开源库.
PyQt4.phonon-很有前途,但不会播放任何内容.出现以下错误:

gst_element_make_from_uri: assertion `gst_uri_is_valid (uri)’ failed

任何帮助,将不胜感激.

解决方法:

使用gstreamer.

  • It needs to be cross-platform.
  • It needs to be able to use the ALSA, PulseAudio or any other common default mixer under Linux.

检查-从gstreamer网站:

GStreamer has been ported to a wide
range of operating systems, processors
and compilers. This include but are
not limited to Linux on i86,PPC, ARM
using GCC. Solaris on x86 and SPARC
using both GCC and Forte, MacOSX,
Microsoft Windows using MS Visual
Developer and IBM OS/400.

GStreamer can bridge to other
multimedia frameworks in order to
reuse existing components (e.g.
codecs) and use platform input/output
mechanisms:

  • Linux/Unix: OpenMAX-IL (via gst-openmax)
  • Windows: DirectShow
  • MacOS X: QuickTime
  • It needs to be able to autodetect the sample frequency.

好的.

  • It needs to be (fairly) simple in usage, if instead someone can give me an extra script that will MAKE it easier for me that’s accepted too.

Gstreamer有很多文档和示例,还有一个强大的社区可以为您提供支持.

  • The only functionality I need is play/pause, seeking is a nice bonus.
  • It needs to be able to play MP3 and OGG. No other formats are important to me.

然后那些不堪重负!

Go get yours

标签:cross-platform,alsa,audio,python
来源: https://codeday.me/bug/20191024/1919603.html