Yu,

Also, it's a good idea to design the main loop to share time with other 
processes. I recommend that you put pygame.time.wait(5) in the loop. You won't 
be able to notice the delay, but your processor usage will decrease.

Jason



________________________________
From: yu <[email protected]>
To: [email protected]
Sent: Thu, March 25, 2010 3:20:01 AM
Subject: Re: [pygame] play sound delay

thanks, Ian

now I know the key is the size of buffer, The smaller, the less
latency it will ...

I'm new to  the coding of sound ... :(

2010/3/25 Ian Mallett <[email protected]>:
> Hi,
>
> Add the following line:
> pygame.mixer.pre_init(frequency=22050, size=-16, channels=8, buffer=256)
>
> Immediately after these lines at the beginning of your file:
> import pygame
> from pygame.locals import *
>
> And before:
> pygame.init()
>
> So:
> import pygame
> from pygame.locals import *
> pygame.mixer.pre_init(frequency=22050, size=-16, channels=8, buffer=256)
> pygame.init()
> #Rest of your code
>
> Ian
>



      

Reply via email to