[Tutor] Pygame mixer music
Alan Gauld
alan.gauld at yahoo.co.uk
Sat Feb 22 17:31:17 EST 2020
On 22/02/2020 17:33, Mikael Lenander wrote:
> created this simple program.
>
> from pygame import mixer
>
> mixer.init()
> mixer.music.load("journey.wav")
> mixer.music.play()
> This program plays the music as it should. However, when I run the program
> using an mp3 file instead of wav, I get this error message.
>
> Traceback (most recent call last):
> File "C:/Users/Mikael/PycharmProjects/peli3/music.py", line 6, in <module>
> mixer.music.load("miugemusaa.mp3")
> pygame.error
As it says it is a pygame error, so you will probably get more
advice on the pygame support forum. However things to check are
whether you need to install or configure specific codecs to play mp3s.
There are (or used to be) licensing issues with mp3 files that
meant not all software supported it by default. You might have
to do something to tell pygame about lame (or whatever decoder
you use)
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list