[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Only first call to Sound.play() is working



Hello,

Sorry for the potentially silly question, but I have an ~2 second sound file that I want to play twice with a specific time delay between each time (time delay is longer than the length of the sound file). 

The sound plays once, but for some reason the second call to .play() is not producing any sound.

My script is basically:

import time
import pygame

pygame.mixer.init()
sound = pygame.mixer.Sound("my_sound_file.wav")
sound.play()
time.sleep(10)
sound.play()

I tried looking in the docs at https://www.pygame.org/docs/ref/mixer.html, but couldn't find anything that addresses this. 

Thanks for your help!
Avi