cardindex.info version 0.1 author: gnubien contact: memo gnubien at freenode.net license statement: see the end of this file Questions, comments, corrections or additions to this info page are welcome; contact gnubien at the above listed address or contact me in #alsa at freenode.net Note: A bash script to add alsa index options is in the pre-alpha stage of development; If you wish to contribute to the development of the bash script contact gnubien This info page explains the proceedure to use to change the order of the sound cards that alsa has listed on your computer; the command to list the sound cards is: cat /proc/asound/cards Example output of cat /proc/asound/cards is: 0 [Audigy2 ]: Audigy2 - Audigy 2 [SB0240] Audigy 2 [SB0240] (rev.4, serial:0x10071102) at 0xc000, irq 16 1 [V8237 ]: VIA8237 - VIA 8237 VIA 8237 with ALC655 at 0xdc00, irq 22 Notice the numbers at the beginning of each line with a bracket "[" following the number; This number is the index number which alsa uses to access a particular card; From the example output "0 [Audigy2" means card 0 is an Audigy2 soundcard; Card 0 is the default soundcard that alsa will use; From the example output "1 [V8237" means card 1 is a V8237 soundcard; Card 1 or any Card number greater than 0 is NOT the default alsa soundcard; If you wish to change the order of the soundcards then you must inform alsa which sound module to load as the default card 0; Loaded Alsa sound modules command: cat /proc/asound/modules Example output of cat /proc/asound/modules: 0 snd_emu10k1 1 snd_via82xx Notice the the card order, or index is listed in the output; From the example output " 0 snd_emu10k1" is Card 0's sound module snd_emu10k1; From the example output "1 snd_via82xx" is Card 1's sound module snd_via82xx; You now have the info you need to create the alsa command to change the card order or index as it is called in alsa terminology; To do that you must determine which file to edit; some examples of the files to edit in the major linux distributions are: Slackware, Archlinux: /etc/modules.conf Fedora: unknown presently Suse: unknown presently some linux distributions: /etc/modprobe.conf Gentoo: /etc/modules.d/alsa Debian: /etc/modprobe.d/alsa-base Ubuntu: /etc/modprobe.d/alsa-base 2.4 kernel Ubuntu and Debian: /etc/modutils/alsa-base This command will list only the file that exists: ls {/etc/modules.conf,/etc/modprobe.conf,/etc/modules.d/alsa,/etc/modprobe.d/alsa-base} 2> /dev/null This command will print the alsa index commands for your installed cards: cat /proc/asound/modules |awk '{print $2}' |sed 's/^/options /;s/$/ index=-/' |tac | awk '{print $0NR}' |tac Example output from this command: options snd_emu10k1 index=-2 options snd_via82xx index=-1 Whichever file is appropriate to edit for your linux distribution This is an example of the alsa commands to include at the "end of file": options snd-last-card index=-2 options snd-second-card index=-1 options snd-first-card index=0 Notice the order of the alsa commands; The last card to be loaded by alsa is listed first; The first card to be loaded by alsa is listed last; From the example: "snd-last-card" is the sound module for the last card you want alsa to load; Using the above examples "snd-last-card" would be "snd-emu10k1" if you wanted the Audigy2 card to be loaded as Card 1; Using the above examples "snd-first-card" would be "snd-via82xx" if you wanted the V8237 card to be loaded as Card 0 which would be the Default alsa card; As ROOT and not sudo edit the appropriate file in the /etc directory and save the file after you have added the alsa index commands at the end of the file; Example: As ROOT and not sudo edit /etc/modules.conf; Using the previous example output these two lines were added at the "end of the file": options snd-emu10k1 index=-1 options snd-via82xx index=0 You need to restart alsa to confirm your file edit has succeeded: Close all sound applications, daemons and mixers first; Example commands to restart alsa: gentoo: as root: /etc/init.d/alsasound restart If your linux distro does not have an alsa restart script you can REBOOT or most 2.6 kernels allow this command to unload all sound modules: modprobe -r $(lsmod |grep ^snd |awk '{print $1}') ##lsmod |grep "^snd" |awk {'print $1'} |xargs -i modprobe -r {} if the previous command succeeded then run this command: modprobe snd-first-card-sound-module; modprobe snd-second-card-sound-module From the above examples the command would be: Example: modprobe snd-via82xx; modprobe snd-emu10k1 If these commands do not load the alsa modules then REBOOT List your NEW card order with this command: cat /proc/asound/cards Example output of cat /proc/asound/cards: 0 [V8237 ]: VIA8237 - VIA 8237 VIA 8237 with ALC655 at 0xdc00, irq 22 1 [Audigy2 ]: Audigy2 - Audigy 2 [SB0240] Audigy 2 [SB0240] (rev.4, serial:0x10071102) at 0xc000, irq 16 If the order is not correct then either you edited the incorrect file in the /etc directory or you made a spelling or syntax error in the alsa commands added to that /etc file; Double check your edited lines in the /etc file you recently added the alsa commands to; Ask in #alsa or post a question at your linux distributions forum page if you can not get the sound card order correct; If you can not get alsa to load the sound cards in the correct order then as ROOT edit the /etc file and remove the alsa commands you just added to that file, save the file and exit the editor reverse module loading: cat /proc/asound/modules |awk '{print $2}' |sed 's/^/modprobe /' |tac license statement: cardindex.info version 0.1 author: gnubien contact: memo gnubien at freenode.net # Copyright (C) 2007 Free Software Foundation. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.