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

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 <geometrian@xxxxxxxxx>:
> 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
>