OneGramHorse
Posts: 3
Joined: Sun Jun 10, 2012 9:25 pm

Pygame error: audio problem (resolved)

Sun Jun 10, 2012 9:40 pm

Hi, I want to learn python scripting / programming, but run into some error messages when playing around with pygame code.
Example:

Code: Select all

banania@raspberrypi:~$ ./sound.py
ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
ALSA lib conf.c:4170:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4170:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4170:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4649:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2190:(snd_pcm_open_noupdate) Unknown PCM default
ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
ALSA lib conf.c:4170:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4170:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4170:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4649:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2190:(snd_pcm_open_noupdate) Unknown PCM default
Traceback (most recent call last):
  File "./sound.py", line 7, in <module>
    pygame.mixer.init()
pygame.error: No available audio device
Line 7 which causes the problems is simply

Code: Select all

pygame.mixer.init()

texy
Forum Moderator
Forum Moderator
Posts: 5161
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Pygame error: audio problem

Mon Jun 11, 2012 6:29 am

The ALSA drivers are not installed by default, have you tried this :
http://www.raspberrypi.org/phpBB3/viewt ... all#p93439

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

OneGramHorse
Posts: 3
Joined: Sun Jun 10, 2012 9:25 pm

Re: Pygame error: audio problem

Mon Jun 11, 2012 7:49 am

Hi,

Thanks, yes I tried that, but I still get that error message.
Could it be that the problem is caused by me running my RaspPi headless, i.e. I only ssh onto it, then use thightvncserver to access the desktop environment remotely?

Playing sound files (using aplay) directly from the command line (but not from a terminal within the desktop environment) via ssh works fine though...

Cheers for all help.

OneGramHorse
Posts: 3
Joined: Sun Jun 10, 2012 9:25 pm

Re: Pygame error: audio problem

Mon Jun 11, 2012 7:34 pm

Just to confirm:
it's indeed the tighvncserver that seems to be the problem. just tried the code while hooked directly to an hdmi screen: the py code now runs correctly with sound being played.

i still get a warning message: 'no soundcard'...

thanks for the help

Return to “Troubleshooting”