Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pygame.init gives 'there is no soundcard'

Tags:

python

pygame

Everytime I run pygame.init() I get "there is no soundcard" message. One thread in the ubuntu forums said to run pygame.init() twice and that message will disappear. The thing is, when I write a script then run the script from terminal, I still get the no sound card message.

What should I do?

Python 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24) 
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame, sys
>>> pygame.init()
there is no soundcard
(6, 0)
>>> 

Thanks!

like image 438
Jim Syyap Avatar asked Dec 06 '25 18:12

Jim Syyap


1 Answers

I get the same error and just fix it on my linux-mint14 today.

First, I use apt-cache depends python-pygame to see the packages depended by python-pygame.

The result is:

依赖: python2.7
依赖: python
依赖: python
依赖: libc6
依赖: libjpeg8
依赖: libpng12-0
依赖: libportmidi0
依赖: libsdl-image1.2
依赖: libsdl-mixer1.2
依赖: libsdl-ttf2.0-0
依赖: libsdl1.2debian
依赖: libsmpeg0
依赖: libx11-6
依赖: python-numpy
依赖: ttf-freefont
  fonts-freefont-ttf
建议: timidity
冲突: <python2.3-pygame>
冲突: <python2.4-pygame>
替换: <python2.3-pygame>
替换: <python2.4-pygame>

It suggests me to install the package timidity.

Then, I use sudo apt-get install timidity to install it.

After that, there's no soundcard error when I use pygame.init()

like image 168
wind4869 Avatar answered Dec 08 '25 06:12

wind4869



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!