Ubuntu 9.04 sound problem fixed

I have a brand new installation of Ubuntu 9.04 (with KDE4 as my default UI) on my desktop PC.
My problem was no sound in Youtube.com and in the game Openarena. However the login sound in Ubuntu played loud and clear.
I located the problem to be related to my ATI HD 2400 PCI-E graphics card. Alsa had this configured as my primary sound card and not my onboard VIA sound card.
This is how I solved it:
Step 1:
Go to a terminal and write:
aplay -l
The output will be something like this:
**** List of PLAYBACK Hardware Devices ****
card 0: HDMI [HDA ATI HDMI], device 3: ATI HDMI [ATI HDMI]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: V8237 [VIA 8237], device 0: VIA 8237 [VIA 8237]
Subdevices: 4/4
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
card 1: V8237 [VIA 8237], device 1: VIA 8237 [VIA 8237]
Subdevices: 1/1
Subdevice #0: subdevice #0
In this output I can see my VIA sound card as Card 1, Device 0
Step 2:
Then I edited a file called asound.conf located in /etc (the file was not there so I created it)
sudo kate /etc/asound.conf
and put in the following configuration:
pcm.!default {
type hw
card 1
device 0
save the file
Step 3:
restart ubuntu.
Voila! Sound was playing everywhere.

Skriv et svar