tackyattack
Posts: 14
Joined: Mon Feb 25, 2013 10:18 pm

Pygame causes ALSA Underrun

Sun Dec 08, 2013 12:39 am

So, I'm having some trouble with a python script that uses pygame to play some sounds. The problem begins as early as just initing the pygame mixer. As soon as it's setup, I get back messages saying:

Code: Select all

ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred
The sounds get filled with horrible noise and there's tons of popping that takes place.
To check if my Pi could manage just playing a song, I used aplay with a 44100kHz mono audio file. For the most part, it plays just fine, but at the beginning I got back:

Code: Select all

underrun!!! (at least 28.951 ms long)
Thanks for any help!

User avatar
davef21370
Posts: 897
Joined: Fri Sep 21, 2012 4:13 pm
Location: Earth But Not Grounded

Re: Pygame causes ALSA Underrun

Sun Dec 08, 2013 7:59 am

Take a look at the pygame.mixer.pre_init() function and try altering the buffer size.

Dave.
Apple say... Monkey do !!

tackyattack
Posts: 14
Joined: Mon Feb 25, 2013 10:18 pm

Re: Pygame causes ALSA Underrun

Sun Dec 08, 2013 6:02 pm

davef21370 wrote:Take a look at the pygame.mixer.pre_init() function and try altering the buffer size.

Dave.
Doesn't seem to change anything. Still occurs.

Return to “Python”