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

Re: [pygame] Choppy sound playback



Chris Smith wrote:
> Yes, I am using Linux, so I'll just follow the other thread.
> 
> What I find strange though is that another program written in PyGame
> (although the sound code is a bit different) works just fine. I'll try
> and isolate the differences and see if I can track down exactly what
> code does what

Did you have a look at the buffer size given to pygame.mixer.init ? A
larger buffer might help against choppy playback, but it will probably
increase the sound latency.

-- Karl

> On 5/9/07, *Andrew Pape* <andrew_pape@xxxxxxxxxxxx
> <mailto:andrew_pape@xxxxxxxxxxxx>> wrote:
> 
>     Hi,
> 
>     I recently had a similar problem, and the solution, given to me, is
>     below. It assumes you're running linux.
>     Hope it helps. The first "export" line did the trick for me. If you
>     need further help, you'll have to ask others.
> 
>     Cheers,
> 
>     Andrew.
> 
>     >you can force SDL to use ALSA or OSS by setting an environment
>     variable,
>     >see this page: http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fenvvars
> 
>     >You could try using the OSS emulation provided by ALSA:
> 
>     >$ export SDL_AUDIODRIVER=dsp
>     >or:
>     >$ export SDL_AUDIODRIVER=dma
>     >then:
>     >$ python program-name.py
> 
>     >or forcing ALSA:
> 
>     >$ export SDL_AUDIODRIVER=alsa
> 
>     >In my travels I've encountered stories of the ALSA OSS emulation
>     working
>     >"better" than the native ALSA drivers, I can't verify that though,
>     >cheers,
>     >John.
> 
>