-1

Pygame is playing .wav completely fine but when it comes to .mp3 it gives this error " pygame.error: music_drmp3: corrupt mp3 file (bad stream). ".

I tried shifting from .music to .sound but it made matters worse. This is the simple version of the code which involves the problem snippet

from pygame import mixer

# Starting the mixer
mixer.init()

# Loading the song
mixer.music.load("A Lowly Shoe Salesman.mp3")

# Setting the volume
mixer.music.set_volume(0.7)

# Start playing the song
mixer.music.play()


It gives this error

pygame 2.5.1 (SDL 2.28.2, Python 3.11.3)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "f:\CODE\python\SpotifyDownloader\music.py", line 7, in <module>
    mixer.music.load("A Lowly Shoe Salesman.mp3")
pygame.error: music_drmp3: corrupt mp3 file (bad stream).
  • What do you mean by the problem is with my file. Isn't mp3 supported by pygame? – B1 FOOTBALL Aug 24 '23 at 21:06
  • If you meant in general that the file is corrupted then you are wrong cz the file is playing inside media players and this is not the only file i have tried. I tried this with almost 15 mp3 files and the result is the same but for wav it works fine. – B1 FOOTBALL Aug 24 '23 at 21:09

0 Answers0