Dec-25-2020, 11:59 PM
hello
I'm going through the book 'making games with pygames', but I can't make python play music. The sound works fine but not the music
Here's my code:
If I play MP3 files I get this: pygame.error: Unrecognized audio format
which i understand but pygame is suppose to recognize mp3 so.... (i tried playing with the name file in case i wrote FFT.mp3.mp3 but i get the same thing)
And if I play OGG files i get this: ALSA lib pcm.c:8526:(snd_pcm_recover) underrun occurred
And like I said soundObj = pygame.mixer.Sound('beep1.ogg') works just fine.
Any help would be appreciated.
Thank you for your time.
I'm going through the book 'making games with pygames', but I can't make python play music. The sound works fine but not the music
Here's my code:
soundObj = pygame.mixer.Sound('beep1.ogg') soundObj.play() import time time.sleep(1) soundObj.stop() pygame.mixer.music.load('FFT.wav') pygame.mixer.music.play(-1, 0.0) pygame.mixer.music.stop() while True: DISPLAYSURF.fill(WHITE) DISPLAYSURF.blit(textSurfaceObj, textRectObj) for event in pygame.event.get(): if event.type == QUIT: pygame.quit() sys.exit() pygame.display.update()If I play WAV files I get this error:ALSA lib pcm.c:8526:(snd_pcm_recover) underrun occurred
If I play MP3 files I get this: pygame.error: Unrecognized audio format
which i understand but pygame is suppose to recognize mp3 so.... (i tried playing with the name file in case i wrote FFT.mp3.mp3 but i get the same thing)
And if I play OGG files i get this: ALSA lib pcm.c:8526:(snd_pcm_recover) underrun occurred
And like I said soundObj = pygame.mixer.Sound('beep1.ogg') works just fine.
Any help would be appreciated.
Thank you for your time.