You could consider polling the mixer until the sound stops so you can
avoid hardcoding the time to wait until exit/
https://www.pygame.org/docs/ref/mixer.html#pygame.mixer.get_busy
On Sun, Apr 22, 2018 at 10:07 AM, Avi Yaar wrote:
> Thanks Greg and Pablo for the advice. It
Thanks Greg and Pablo for the advice. It turned out to be what Greg
mentioned, that the second call to play() wasn't making any sound because
the script terminated immediately after. Adding a second time.sleep(10)
solved the problem.
Thanks again!
Avi
On Fri, Apr 20, 2018 at 2:15 AM Greg Ewing
Pablo Moleri wrote:
import time
import pygame
pygame.mixer.init()
sound = pygame.mixer.Sound("my_sound_file.wav")
sound.play()
time.sleep(10)
sound.play()
If that's you're entire program, I'd say it's finishing before
the second sound gets a chance to play. The
Hi there,
You probably need to flush events. Pygame needs to run an event loop,
otherwise the event queue gets clogged. See:
https://stackoverflow.com/a/13653825/488012
Regards,
Pablo
El vie., 20 abr. 2018 0:58, Avi Yaar escribió:
> Hello,
>
> Sorry for the potentially
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