How to define the default Alsa card

From Salix OS
Revision as of 23:13, 7 February 2010 by JRD (Talk | contribs)

Jump to: navigation, search

If you have more than one card in your system, or precisely, than the system see more than one card (one sound card and a usb camera with a microphone for example), you must define which one is the default one. Here are the steps to achieve this:

Firstly, determine the name of your sound card:

 cat /proc/asound/cards

The name of your card is in the brackets. For me:

 0 [U0x46d0x9a4    ]: USB-Audio - USB Device 0x46d:0x9a4
                      USB Device 0x46d:0x9a4 at usb-0000:00:10.3-1, full speed
 1 [VT82xx         ]: HDA-Intel - HDA VIA VT82xx
                      HDA VIA VT82xx at 0xfbffc000 irq 17

The one I want to make it default is VT82xx

Then add the following file /etc/profile.d/alsa.sh with this content:

 #!/bin/sh
 default_alsa_card=VT82xx
 export ALSA_CARD=$default_alsa_card
 export ALSA_PCM_CARD=$default_alsa_card
 export ALSA_CTL_CARD=$default_alsa_card

Of couse, replace VT82xx with your sound card name. Make this file executable with:

 chmod +x /etc/profile.d/alsa.sh

If you want to have it works immediately, source that file with source /etc/profile.d/alsa.sh and run your audio applications from this terminal or simply reboot.