开发者

Playing audio file with Python

I've seen most of the questions on this topic but almost all of them are outdated. (This is not a dupe)

My requirement is a preferably light weight library for simply playing audio files such as mp3,etc from Python (2.7)

These are the libraries that I've so far looked into and I'm listing what are the things that are stopping me from using each of them:

  • PyMedia: it was last updated in Feb, 2006
  • Mp3Play: supports only XP and was last updated in 2008.

I've also tried Pyglet but even this doesn't look good. Also heard that wx has support for mp3 and I'm 开发者_开发知识库trying it. Any comments about the same?

Which reliable lightweight library do others use these days?

PS: please post one library only per answer


I'm not sure what your issue is with pyglet. Playing an mp3 using that couldn't be simpler:

import pyglet
sound = pyglet.media.load('mysound.mp3', streaming=False)
sound.play()
pyglet.app.run()

pyglet is well-maintained, cross-platform, and very small for a multimedia library.


I know this is late but anyway...

Try just_playback. It's a wrapper around miniaudio that can read multiple file formats including mp3 and provides playback control functionality like pausing, resuming, seeking and setting the playback volume.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜