Using firefox in Linux with multiple sound cards

If there are multiple sound cards installed on your system (webcams can show up as these too), Mozilla Firefox will use the first sound card that Alsa has detected which may not be the one you want.

To get a listing of all the sound cards currently detected by Alsa run the following command:

cat /proc/asound/cards
 0 [U0x46d0x992    ]: USB-Audio - USB Device 0x46d:0x992
                      USB Device 0x46d:0x992 at usb-0000:00:02.1-4, high speed
 1 [NVidia         ]: HDA-Intel - HDA NVidia
                      HDA NVidia at 0xfe024000 irq 22
 2 [Audigy2        ]: Audigy2 - SB Audigy 2 ZS [SB0350]
                      SB Audigy 2 ZS [SB0350] (rev.4, serial:0x20021102) at 0xbc00, irq 17

Notice the numbers on the left, choose the number for sound card you wish to use for Firefox, the edit or create the following file as the user you normally use Firefox as (not as root), specifying the default sound card to use:

vi ~/.asoundrc
pcm.!default {
        type hw
        card 2
}

ctl.!default {
        type hw
        card 2
}

In the example above the third sound card is setup as the default card to use in Alsa and Firefox.

Restart Firefox to use the new setting and test, with a video from Youtube or similar.

Last updated: 25/04/2012