I am making a Game using Pygame and what I'm trying to do is to have a main sound for every level and some default sounds being heard when collecting points (e.g.)
So, I load the main level music using:
pygame.mixer.music.load(music_file)
pygame.mixer.music.play(-1)
Now, what I want to do is to play a specific sound whenever a player collects a point. I cannot stop the music using:
pygame.mixer.music.stop()
pygame.mixer.music.load(point_music)
pygame.mixer.music.play()
because the level's music will stop playing.
So, I've tried doing something like this:
points_sound = pygame.mixer.Sound("point.mp3")
points_sound.play()
I know that sound playing in pygame runs on its own thread but I am sure that the program/game does not terminate prior to finish playing the sound.
Long story short: The player can collect points but I am unable to make pygame play the collecting points sound.
points_sound.play()
looks good, Is there a problem with that soulution? – pmolerimusic
and that only OGG and WAV are supported forSound
. Have you tried one of the formats that are officially supported? – Silas Ray