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

[pygame] pygame.mixer buffer



Hello all,

I've recently purchased a new laptop and my game Natto-Cat (or should I
say, my computer) seems to be suffering from this bug described in the
Pygame mixer documentation:

"NOTE: there is currently a bug on some windows machines which makes
sound play back 'scratchy'. There is not enough cpu in the sound thread
to feed the buffer to the sound api. To get around this you can increase
the buffer size. However this means that there is more of a delay
between the time you ask to play the sound and when it gets played."

My older, slower laptop was fine.  Go figure.

Anyway, if I increase the buffer, the pops and crackles go away, but
there is indeed a latency in the sound.  That's not a big deal because
it's not so noticable after a while, except for very short impact type
sounds... however repeating sounds develop a cadence/rhythm that IS
noticably odd.  Basically, with the increased buffer, the cat digging
through natto doesn't have a steady rhythm, but instead the cadence of a
horse galloping.  ;)

Does anyone have any more information or suggestions on how to fix this,
or what causes it?  Is there an SDL_mixer.dll available without this
problem?  I searched around on libsdl.org but didn't find any useful
information, just suggestions to increase the buffer to stop pops and
crackles.

I guess my only idea at this point is to open all my samples in an
editor and trim them as much as possible...  or write some code to check
if too many similar sounds (blood/custard splatters sometimes overlap)
are playing at once and overwhelming the mixer.