Skip to content Skip to sidebar Skip to footer

Play Sounds In A Loop From A List

i got this list awith 2 sounds and i want to play them with this code. Unfortunally it plays only the last sound of the list. I know that using pygame.Sound is a solution, but i do

Solution 1:

I was able to play music with pygame only after creating a display, i.e.:

import pygame
pygame.init()
pygame.display.set_mode(pygame.display.list_modes()[-1]) # smallest resolution available
pygame.mixer.init()
pygame.mixer.music.load('1.mp3')
pygame.mixer.music.play()
pygame.mixer.music.queue('2.mp3')

while pygame.mixer.music.get_busy():
    pygame.time.Clock().tick(10)

Notes:


Post a Comment for "Play Sounds In A Loop From A List"