I'm a bit flabberghasted at the lack of alsa documentation on multiple sound cards. The totality of documentation on the topic amounts to dick. So here's my attempt at figuring out this whole mess. This is not an exhaustive guide, it is simply my interpretation of the available docs, implemented in such a way as to assist those of us who learn better by example.
While the focus of this doc will be on the setup of /etc/modules.d/alsa , I will try to cover the rest.
1: What sound card(s) do I have?
The simplest way to do this with PCI devices is to do the following
#lspci | grep -i audio
Code: Select all
h2so4 ~ # lspci -vv | grep -i audio
0000:00:05.0 Multimedia audio controller: C-Media Electronics Inc CM8738 (rev 10)
0000:00:0d.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 02)
0000:00:10.0 Multimedia audio controller: Aureal Semiconductor Vortex 2 (rev fe)
2: 2.6 kernel configuration
I'm not going to tell you how to compile your kernel. I am going to tell you how to configure your sound. We're going to build everything as modules. I know some of you are going to want to go static, but I want you to trust me. Building as modules gives you more control over the loading order of the devices. This will be important later on. So:
(as root)
cd /usr/src/Linux
make menuconfig (or genkernel --menuconfig all )
Code: Select all
Device Drivers --->
Sound --->
<*> Sound card support
Advanced Linux Sound Architecture --->
<M> Advanced Linux Sound Architecture
<M> Sequencer support
< > Sequencer dummy client
<M> OSS Mixer API
<M> OSS PCM (digital audio) API
[*] OSS Sequencer API
PCI devices --->
<M> Aureal Vortex 2
<M> Bt87x Audio Capture
<M> C-Media 8738, 8338
ALSA USB devices --->
<M> USB Audio/MIDI driver
Under PCI devices, you should select the sound cards that you had. These were the three I had listed.
Exit, save, make, make modules_install, cp to /boot, grubify it (you gentoo users know the drill)
3: Loading the modules
I use cold/hotplug. It makes it so that things load easily and I don't have to do much when adding temporary hardware to my box. There is a problem with hotplug though. It's that you have little control over the order in which the modules are loaded. Why is this a problem? Let me explain a little.
I want the Vortex2 to be my primary sound card. I will do 99.99% of my stuff with it. It is better than the CMI, does hardware mixing, and has a snazzy EQ.
So how do we control the order in which the modules load? Via the module autoloader.
h2so4 linux # vi /etc/modules.autoload.d/kernel-2.6
Code: Select all
# /etc/modules.autoload.d/kernel-2.6: kernel modules to load when system boots.
# $Header: /var/cvsroot/gentoo-src/rc-scripts/etc/modules.autoload.d/kernel-2.6,v 1.1 2003/07/16 18:13:45 azarah Exp $
#
# Note that this file is for 2.6 kernels.
#
# Add the names of modules that you'd like to load when the system
# starts into this file, one per line. Comments begin with # and
# are ignored. Read man modules.autoload for additional details.
snd_au8830
snd_cmipci
snd_bt87x
snd_usb_audio
This sets the orders that the modules will load in, and will do so before coldplug kicks in (and sets some random order, like making my USB webcam my default audio device!). If someone else knows a better way to set up the module loading order, ping the thread and I will add it. This seemed like the most simple way to me.
Go here if you don't know what the driver name is
http://www.alsa-project.org/alsa-doc/
When you reboot, you can do an lsmod to see that the drivers are loaded.
h2so4 linux # lsmod
Code: Select all
Module Size Used by
snd_pcm_oss 52776 0
snd_mixer_oss 17152 1 snd_pcm_oss
snd_seq_midi 6688 0
snd_seq_oss 33536 0
snd_seq_midi_event 6784 2 snd_seq_midi,snd_seq_oss
snd_seq 52496 5 snd_seq_midi,snd_seq_oss,snd_seq_midi_event
ov511 127904 0
usbhid 34112 0
ohci_hcd 21380 0
nvidia 3464412 12
tuner 19876 0
tvaudio 22688 0
bttv 157644 0
video_buf 18436 1 bttv
firmware_class 7936 1 bttv
i2c_algo_bit 8840 1 bttv
btcx_risc 4104 1 bttv
i2c_core 20112 4 tuner,tvaudio,bttv,i2c_algo_bit
ehci_hcd 29956 0
uhci_hcd 31504 0
ohci1394 32388 0
ieee1394 100148 1 ohci1394
via_agp 7936 1
agpgart 27432 2 via_agp
snd_usb_audio 67808 2
snd_usb_lib 11520 1 snd_usb_audio
usbcore 108260 9 ov511,usbhid,ohci_hcd,ehci_hcd,uhci_hcd,snd_usb_audio,snd_usb_lib
snd_bt87x 10568 1
snd_cmipci 28708 1
snd_opl3_lib 9216 1 snd_cmipci
snd_hwdep 7684 1 snd_opl3_lib
snd_au8830 61092 2
snd_pcm 93192 5 snd_pcm_oss,snd_usb_audio,snd_bt87x,snd_cmipci,snd_au8830
snd_timer 24196 3 snd_seq,snd_opl3_lib,snd_pcm
snd_page_alloc 7688 2 snd_bt87x,snd_pcm
snd_ac97_codec 86096 1 snd_au8830
gameport 3840 2 snd_cmipci,snd_au8830
snd_mpu401_uart 6400 2 snd_cmipci,snd_au8830
snd_rawmidi 21540 3 snd_seq_midi,snd_usb_lib,snd_mpu401_uart
snd_seq_device 7176 5 snd_seq_midi,snd_seq_oss,snd_seq,snd_opl3_lib,snd_rawmidi
snd 53476 28 snd_pcm_oss,snd_mixer_oss,snd_seq_oss,snd_seq,snd_usb_audio,snd_bt87x,snd_cmipci,
snd_opl3_lib,snd_hwdep,snd_au8830,snd_pcm,snd_timer,snd_ac97_codec,snd_mpu401_uart,snd_rawmidi,snd_seq_device
e100 35712 0
mii 4480 1 e100
Last but not least, we want to configure any options for our cards. I think you have to install alsa-lib and alsa-util first
vi /etc/modules.d/alsa
Code: Select all
# Alsa 0.9.X kernel modules' configuration file.
# $Header: /var/cvsroot/gentoo-x86/media-sound/alsa-utils/files/alsa-modules.conf-rc,v 1.2 2004/07/18 03:40:55 dragonheart Exp $
# ALSA portion
alias char-major-116 snd
# OSS/Free portion
alias char-major-14 soundcore
##
## IMPORTANT:
## You need to customise this section for your specific sound card(s)
## and then run `update-modules' command.
## Read alsa-driver's INSTALL file in /usr/share/doc for more info.
##
## ALSA portion
alias snd-card-0 snd-au8830
alias snd-card-1 snd-cmipci
alias snd-card-2 snd-bt87x
alias snd-card-3 snd-usb-audio
options snd-au8330 id="first" enable_midi="1"
options snd-cmipci id="second"
options snd-bt87x id="third"
options snd-usb-audio id="forth"
## OSS/Free portion
alias sound-slot-0 snd-card-0
alias sound-slot-1 snd-card-1
alias sound-slot-2 snd-card-2
alias sound-slot-3 snd-card-3
# OSS/Free portion - card #1
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
## OSS/Free portion - card #2
alias sound-service-1-0 snd-mixer-oss
alias sound-service-1-3 snd-pcm-oss
alias sound-service-1-12 snd-pcm-oss
## OSS/Free portion - card #3
alias sound-service-2-0 snd-mixer-oss
alias sound-service-2-3 snd-pcm-oss
alias sound-service-2-12 snd-pcm-oss
## OSS/Free portion - card #4
alias sound-service-3-0 snd-mixer-oss
alias sound-service-3-3 snd-pcm-oss
alias sound-service-3-12 snd-pcm-oss
alias /dev/mixer snd-mixer-oss
alias /dev/dsp snd-pcm-oss
alias /dev/midi snd-seq-oss
options snd device_mode=0666
options snd cards_limit=4
rc-update add alsa default
modules-update
you may have to reboot
Things you should know about the above...
- There is only ONE oss sequencer (/dev/midi). I would recommend using the one on your main sound card.
Set the 'mode' if you want anyone other than root to be able to use the sound card.
I called my cards "first, second, third, forth". You can call yours whatever you want.
Cryptic info on the config of this file can be found here.
http://www.alsa-project.org/alsa-doc/do ... =usb-audio
Please ping the thread with anything that I missed.
Thank you for your time,
Frank Russo





