HOWTO: Configure ALSA to handle a USB sound card

From Sabayon Wiki
Revision as of 00:19, 20 February 2009 by Zambayoni (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This guide is targeted towards people who have a USB sound card and want to use it as the default sound card.

First step is to figure out the Vendor id and product id of the sound card: Open the Konsole type su and then type the root password. Once you have become root type in the command (# should not be included! # means that you are root)


Mine gives the following result:

Bus 001 Device 008: ID 145f:0090 
Bus 001 Device 004: ID 046d:c046 Logitech, Inc. 
Bus 001 Device 003: ID 050d:0237 Belkin Components 

An example id is 145f:0090 The ID is made up of 2 part: the first (145f) is the Vendor ID (aka Manufacturer ID) and the second (0090) is the product ID. This is my sound card.

As you can see it has no name. I found out by running lsusb before connecting it and then running it again after connecting. If you do that you will be able to see a new ID which is the USB car you just connected.

A good next step is to permit ALSA to build its own default configuration. As root, type the following command:

#sudo alsaconf

Just choose everything as it defaults, and let 'er go.

After alsaconf is done, there is a configuration file for us to edit. Type the following command being root:

#sudo kwrite /etc/modules.d/alsa

You should see the ALSA configuration file in the Kwrite editor. I changed mine to look like this:

File: (alsa)
alias /dev/mixer snd-mixer-oss
alias /dev/dsp snd-pcm-oss
alias /dev/midi snd-seq-oss
alias char-major-116 snd
alias char-major-14 soundcore

# Set this to the correct number of cards. I have 2 so
options snd cards_limit=2

#This is my USB card so I set it's index and parameters to 0 so that is becomes default. Do the same.
alias snd-card-0 snd-usb-audio
alias sound-slot-0 snd-card-0
#Remember the IDs ? We use them here. Just put 0x in front.
options snd-usb-audio index=0 vid=0x145f pid=0x0090 
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss
alias /dev/dsp snd-usb-oss

#Intel. This was already here because I had run alsaconf. Then I changed everything from 0 to 1.
# --- BEGIN: Generated by ALSACONF, do not edit. ---
# --- ALSACONF version 1.0.14rc2 ---
alias snd-card-1 snd-intel8x0
alias sound-slot-1 snd-card-1
options snd-intel8x0 index=1
alias sound-service-1-0 snd-mixer-oss
alias sound-service-1-1 snd-seq-oss
alias sound-service-1-3 snd-pcm-oss
alias sound-service-1-8 snd-seq-oss
alias sound-service-1-12 snd-pcm-oss
alias /dev/dsp1 snd-intel8x0
# --- END: Generated by ALSACONF, do not edit. ---

Once you have saved the file alsa goto your Konsole and as root type the following:

#update-modules -f

That should reload modules.You should see the console returning OK for each module loaded. Reboot and your done! Don't forget to use Kmix or any other volume controller to set your volume levels.

There are some circumstances, especially after a full system update, in which the above is not quite sufficient. You can see evidence of it in Audacity; check the available playback devices, and you may see the one you don't want set at zero (possibly 0.0, 0.1, 0.2) and the one you do want as 1. So if it's still not working after the above is done, edit (or create anew, that's what I had to do) /etc/modprobe.d/alsa-base. Here is mine:

File: (alsa-base)
# Prevent other drivers from grabbing index 0
options snd-card-1 index=-2
options sound-slot-1 index=-2

# Set internal soundcard as index 0
options snd-usb-audio index=0

Index zero is the default sound device, always. You'll then want to type the following again:

#update-modules -f

and reboot again.

Thanks to all members in the forum who raised questions and gave links to the Gentoo alsa wiki. Advanced Linux users feel free to edit. This Howto is going to be appreciated by many since many users have the same problem. Cheers, RCV