cardindex.info version 0.1author: gnubien contact: memo gnubien at freenode.netlicense statement: see the end of this fileQuestions, 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 gnubienThis info page explains the proceedure to use to change the order of the soundcards that alsa has listed on your computer; the command to list the sound cards is: cat /proc/asound/cardsExample 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 22Notice 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 alsawhich sound module to load as the default card 0;Loaded Alsa sound modules command: cat /proc/asound/modulesExample output of cat /proc/asound/modules: 0 snd_emu10k1 1 snd_via82xxNotice 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 indexas it is called in alsa terminology; To do that you must determine which file to edit; some examplesof the files to edit in the major linux distributions are:Slackware, Archlinux: /etc/modules.confFedora: unknown presentlySuse: unknown presentlysome linux distributions: /etc/modprobe.confGentoo: /etc/modules.d/alsaDebian: /etc/modprobe.d/alsa-baseUbuntu: /etc/modprobe.d/alsa-base2.4 kernel Ubuntu and Debian: /etc/modutils/alsa-baseThis 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}' |tacExample output from this command:options snd_emu10k1 index=-2options snd_via82xx index=-1Whichever file is appropriate to edit for your linux distributionThis 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=0Notice 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 cardto be loaded as Card 1;Using the above examples "snd-first-card" would be "snd-via82xx" if you wanted the V8237 cardto be loaded as Card 0 which would be the Default alsa card;As ROOT and not sudo edit the appropriate file in the /etc directoryand 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=0You 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 restartIf your linux distro does not have an alsa restart script you can REBOOT ormost 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-moduleFrom the above examples the command would be:Example: modprobe snd-via82xx; modprobe snd-emu10k1If these commands do not load the alsa modules then REBOOTList your NEW card order with this command:cat /proc/asound/cardsExample 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 16If 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 commandsadded 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 orderthen as ROOT edit the /etc file and remove the alsa commands you just added to that file, save the file and exit the editorreverse module loading: cat /proc/asound/modules |awk '{print $2}' |sed 's/^/modprobe /' |taclicense 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.