views:

163

answers:

2

I am building an application in pyQt4 and I want it to be able to play audio files. I was considering doing this through pyMedia as I could not get anywhere with the documentation, although the QAudio classes did initially look promising. It is important that the solution be cross-platform. Does anyone have any suggestions?

+1  A: 

Use Phonon ( http://phonon.kde.org/ ). I used it from Java with success, so I expect it will work even better in Python/Linux.

This might also help:

http://0pointer.de/blog/projects/guide-to-sound-apis.html

alex
+2  A: 

As alex said, Phonon looks like your best bet because you can use it with Pyqt. You can find lots of examples of using phonon using google. This one, http://forum.kde.org/viewtopic.php?f=14&t=84275, for example is a command line tool to play audio using phonon. You might also want to take a look at the QSound class. QAudioInput looks interesting for adding support for a mike.

I hope this helps.

P.S.:

  1. The riverbank site does mention the phonon module :)

  2. I found a question on using Phonon + Pyqt - http://stackoverflow.com/questions/1083118/play-mp3-using-python-pyqt-and-phonon

batbrat