python-3.xpygamecrashspydermixer

py.game.mixer.music unable to load .wav files (results in crashed kernel)


I am trying to play a .wav file with the pygame module, however, whenever I run the code block below, it crashes the kernel after a short period of time.

from pygame import mixer

mixer.init()

fname = "journey.wav"
s = mixer.music.load(fname)

The message:

The message

I'm pretty sure this issue is unique to me, but I don't exactly know what is causing it. Thank you for your time.


Solution

  • I had the same problem before. But after deep searching on the web I figured out that pygame doesn't support 32-bit float WAVs. Re-encode it to a signed 16-bit WAV. Here's how to do that using audacity.

    Hope it helps you :)