Scarlett 2i2 USB DAC and Debian 8

I was running into a number of issues getting my Scarlett 2i2 USB DAC to work properly under Debian Linux. It seemed to work OK, except for these intermittent issues:

  • Popping and clicking when launching programs that deliver audio streams (VLC, Telegram desktop, etc.). The LEDs on the device would flicker and blink as if it was resetting.
  • Audacity takes a really long time to start up, with several rounds of popping, clicking, and LED flickering resets and of the DAC.
  • If you were listening to audio in VLC or Rhythmbox and you launched another program that plays audio (for instance, Telegram desktop), the audio would cut out for a moment and then return at a higher pitch. The only way to recover was to restart VLC/Rhythmbox and start audio playback again.

I’m not sure how I stumbled across it tonight, but something online mentioned removing PulseAudio and just using ALSA (since the DAC would handle all of the audio mixing). It took about an hour of testing, but I finally got it working and wanted to share the instructions.

Step 1: Remove PulseAudio and install ASLA utilities

sudo apt-get purge pulseaudio pulseaudio-utils gstreamer0.10-pulseaudio libpulse-browse0 paman pavumeter pavucontrol
sudo apt-get install alsa-base alsa-tools alsa-tools-gui alsa-utils alsa-oss alsamixergui libalsaplayer0

Step 2: Tell ALSA to use the Scarlett 2i2 USB DAC as the primary device

If you don’t do this, ALSA will likely route audio through the motherboard audio card, or your HDMI audio, etc.

Determine which audio device your DAC is:

cat /proc/asound/cards

My output was:

0 [HDMI   ]: HDA-Intel - HDA Intel HDMI
             HDA Intel HDMI at 0xf7834000 irq 36
1 [PCH    ]: HDA-Intel - HDA Intel PCH
             HDA Intel PCH at 0xf7830000 irq 33
2 [NVidia ]: HDA-Intel - HDA NVidia
             HDA NVidia at 0xf7080000 irq 17
3 [USB    ]: USB-Audio - Scarlett 2i2 USB
             Focusrite Scarlett 2i2 USB at usb-0000:00:14.0-4, high speed

In this instance, the Scarlett is device 3. Just direct ALSA to use it.

sudo vi /etc/asound.conf

And then enter this as the file’s contents (replacing 3 with whatever ID your device is from above):

defaults.pcm.card 3 defaults.ctl.card 3

NOTE: This step was the most confusing part of the night. All of the instructions online said to use this format, but this does not work:

pcm.!default {
  type hw
  card 3
}

ctl.!default {
  type hw
  card 3
}

Step 3: Restart, test, and configure a few small things

Restart your computer. When you’re back in, test audio playback from a few programs (VLC, Rhythmbox, Firefox, Flash, etc.)

All programs played for me without any problem, except for VLC which needed a quick tweak:

  1. Go to Tools > Preferences.
  2. Go to the Audio tab.
  3. Set Output module = ALSA audio output.
  4. Set Device = Scarlett 2i2 USB, USB Audio Default Audio Device.
  5. Close VLC and load it again. Audio should now play.

Closing notes

There was another unexpected benefit from making this change. Since ALSA does a better job at recognizing the DAC, it doesn’t offer software volume controls. That’s great because PulseAudio would frequently set the software volume output for the DAC to > 100%, causing clipping and poor audio quality.