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

Re: [pygame] pygame metronome



On Wed, Jul 28, 2010 at 6:01 AM, Brian Gryder <bgryderclock@xxxxxxxxx> wrote:
> I am using "print \a" as the metronome click sound. I am using the
> pygame.time.Clock() to move the position of the metronome meter (called x)
> left and right across the screen. Occasionally the program will stutter and
> the sound with play a little early or late. Is this because I am using
> "print \a" instead of playing a wav file with the pygame library? Any
> suggestions for improvement?

I haven't tried your program, but I would imagine that using print
like this could well result in unpredictable timing. I would suggest
you try following each print with a call to sys.stdout.flush().
(Alternatively, I believe passing '-u' as a command-line argument to
Python has a similar effect, e.g. 'python -u innep.py') I'm not sure
if it will help, but it's easy enough to be worth a shot.