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

2018-04-26 Thread Leif Theden
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

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

2018-04-22 Thread Avi Yaar
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

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

2018-04-20 Thread 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

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

2018-04-19 Thread Pablo Moleri
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

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

2018-04-19 Thread Avi Yaar
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