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

[pygame] Pygame sound delay problem



I have created a basic checkers game using pygame. I have sampled some very
short sounds for use in the game, but there is a 500 to 1000ms delay from
the time I call a sounds play() method to when it actually plays. Some
information: This problem persists from my Windows 7 64-bit desktop and my
Windows XP 32-bit laptop. I am using python 2.7.3 and pygame version 1.9.1.

Some things that I have tried: 
* decreasing the buffer-size passed to pygame.mixer.pre_init() from the 4096
default, incrementally down to 128 -- no change. This was the only 'fix'
that I saw repeatedly throughout the internet.
* ensuring that the frequency of the audio samples, channels, and whatnot
all matched up to my pre_init call. I'll admit that I really don't know much
about audio in general.
* created a small sample demo (to rule out my program loop causing the
delay)
* added a call to pygame.time.wait(125) after the call to .play() a sound,
and it does allow the sound to synch with the animation. However, it also
causes a noticeable delay between clicking on the checkers piece and the
actual pickup animation.
* hacked in pyglet as a sound backend. *sigh* it works GREAT, but then will
have some crazy audio artifacts that happen after some number of sounds of
been played, and not every time. I "dont" like this solution, at all. The
artifacts become unbearably noisy and overwhelming if many concurrent sounds
are played, and they never stop.

Nothing has really helped. So, does anyone have any ideas? Any help would be
greatly appreciated!



--
View this message in context: http://pygame-users.25799.n6.nabble.com/Pygame-sound-delay-problem-tp405.html
Sent from the pygame-users mailing list archive at Nabble.com.