Playing mp3 files with wxPython

Pete Shinners pete at shinners.org
Fri Sep 7 00:42:57 EDT 2001


<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