Playing mp3 files with wxPython

ibwonrr at yahoo.com ibwonrr at yahoo.com
Fri Sep 7 08:46:33 EDT 2001


On Fri, 07 Sep 2001 04:42:57 GMT, "Pete Shinners" <pete at shinners.org>
wrote:

I've tried pygame but get the following error when I call load() for
an mp3 file:
  File "<stdin>", line 1, in ?
pygame.error:  Module format not recoginized

pygame works fine for wav files, but another part of my application
requires mp3.  As a work around, I would consider converting my mp3 to
wav so it can be played, then discarding the wav.  However I don't
know a python way to convert mp3 to wav.



><ibwonrr at yahoo.com> wrote in
>> Any advice on playing mp3 files or mp3 dlls would be greatly
>> appreciated.
>
>pygame can stream mp3 audio. although i'll admit the decoding
>done by the SMPEG library doesn't work on all the mp3s out
>there. but as long as its nice basic mp3, there's a good chance
>it will fly for you :]
>
>you can use pygame's audio without bringing in all the other
>bells and whistles it has. the code would resemble this..
>--------------------------
>
>import pygame.mixer as mixer
>mixer.init(44100)
>mixer.music.load('mymusicfile.mp3')
>mixer.music.play()
>
>---------------------------
>after that you can make a call to "mixer.music.get_busy()" to
>see if it is still playing. streaming and decoding all happens
>in a background thread.
>
>it's totally free to use, but i admit the mp3 support isn't
>100%. other formats like OGG, MOD, WAV, have no trouble, if
>that would be better for you :]
>
>
>
>




More information about the Python-list mailing list