How to define the default Alsa card

From Salix OS
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:

Doing it with a GUI

In Salix 13.1 and newer there is the gtkalsasetup tool, found in the salixtools-gtk package, that can be used to define the default ALSA sound card. Just launch the "ALSA sound card" item found in your System menu and you can select the card you want to use as default.

Doing it manually

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.

Links

  • Advanced: ALSA Wiki How to choose a particular order for multiple installed cards