cemulate
cemulate

Reputation: 2333

Best python solution to play ALL kinds of audio on Windows (and Linux)?

I'm trying to write some scripts to play some of my music collection with python. Finding python modules that will play ogg and mp3 is not a problem. However, I'm having repeated failures with aac-encoded m4a files from iTunes (not DRM). pygame's audio machinery doesn't support them, so I tried pymedia:

a = pymedia.player.Player()
a.start()
a.startPlayback("myM4a.m4a", format='aac')

I've tried several versions of the last line of code, including omitting the format argument, changing the files to mp4, etc. mp3's work fine, however.

pymedia even claims to support aac encoded files, but the project appears to have been abandoned anyway.

Is there a good, up to date, solution for playing ALL types of audio in python? What is used by existing python media centers/players?

I should add that I intend to use this primarily on windows, so windows support for the library is a must, but cross-platform would obviously be preferable.

Upvotes: 3

Views: 4060

Answers (2)

djsumdog
djsumdog

Reputation: 2710

You should look at the gStreamer API. It has plugins for many major audio types, is used by many audio players including Banshee and Rhythmbox and it can run on Linux, Windows and Mac. It has Python bindings as well as bindings for many other languages:

http://gstreamer.freedesktop.org/bindings/

Upvotes: 1

pawroman
pawroman

Reputation: 1300

MPlayer plays most known audio formats, and there's Python wrapper for it:

http://code.google.com/p/python-mplayer/

And a list of audio codecs supported by MPlayer:

http://www.mplayerhq.hu/DOCS/codecs-status.html#ac

Upvotes: 0

Related Questions