Archlinux Alsa Sound Tutorial

May 9, 2018 15:57 · 387 words · 2 minute read Arch Linux

Recently I had to delve into the land of Arch Linux’s ALSA to hook up my external sound card. I use a Focusrite Scarlett 2i2, they are amazing units and I wanted to hook it up to my desktop box. I found out that setting up sound on Arch Linux was fairly easy but being it something that won’t be performed very often, documentation goes a long way.

The ALSA page gives a good overview of how it works and is a great place to start reading. The key points for me were:

  • Getting available cards from cat /proc/asound/cards
  • Using speaker-test -c 2 for testing
  • Setting default card in /usr/share/alsa/alsa.conf
  • Installing the alsa-utils package to use alsamixer

First you’ll want to see what cards are available. Open a terminal and run cat /proc/asound/cards and you should get something similar to this:

0 [HDMI           ]: HDA-Intel - HDA Intel HDMI
                  HDA Intel HDMI at 0xf7e34000 irq 31
1 [PCH            ]: HDA-Intel - HDA Intel PCH
                  HDA Intel PCH at 0xf7e30000 irq 30
2 [USB            ]: USB-Audio - Scarlett 2i2 USB
                  Focusrite Scarlett 2i2 USB at usb-0000:00:14.0-4, high speed

The card names come from the name after the numbers 0, 1, 2 so my available cards are HDMI, PCH, and USB. I’m going to test my USB card to make sure that I can indeed hear sound from it with speaker-test -D default:USB -c 2. You should be able to hear white noise coming out of your speakers now. If no sound comes out check that the card is on with volume, speaking from experience, and if that doesn’t work you can launch alsamixer press F6 to change to the desired sound card and double check that it isn’t muted. If you still don’t have sound then consult the ALSA page for trouble shooting. After you’ve confirmed your card works you’ll probably want to set it as the default. You can edit the file /usr/share/alsa/alsa.conf and look for the lines:

defaults.ctl.card 0
defaults.pcm.card 0

Which you can change to the number of the card that you want. After setting that you should be able to restart programs and start using your new card. If your sound device has an external volume like mine you’ll use that but if it doesn’t then you can use alsamixer for controlling the levels.