HOWTO: Disable pulseaudio in Ubuntu

This has been tested on Ubuntu 12.04.1 and 12.10 x86_64

I got myself a USB DAC and a set of nice headphones for Christmas. One of the main concerns was that the new hardware must work with Linux since Linux is my main OS at home. As it turns out most USB DACs work out of the box with Linux as they are standard USB compliant sound devices.

All modern Linux distributions seem to use pulseaudio as a front-end for ALSA these days. The thing that pulseaudio does is to remix all audio streams in software which is a bad thing if you have some nice audio gear that probably can do this much better.

The following explains how to uninstall pulseaudio and to configure ALSA on a per user basis. It also explains how to up-sample your audio from spotify, deadbeef, vlc and so on via ALSA.

Note: By disabling/removing pulseaudio you will loose some functionality but you will gain better sound. ;-)

1st step: Remove pulseaduio

# apt-get autoremove pulseaudio

2nd step: Install gnome-alsamixer

# apt-get install gnome-alsamixer

3rd step: Find out what card number your sound devices have

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: AD198x Analog [AD198x Analog]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 1: AD198x Digital [AD198x Digital]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 2: AD198x Headphone [AD198x Headphone]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
card 1: DAC [Nuforce Icon HDP DAC], device 0: USB Audio [USB Audio]
 Subdevices: 0/1
 Subdevice #0: subdevice #0
card 2: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
card 2: NVidia [HDA NVidia], device 7: HDMI 0 [HDMI 0]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
card 2: NVidia [HDA NVidia], device 8: HDMI 0 [HDMI 0]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
card 2: NVidia [HDA NVidia], device 9: HDMI 0 [HDMI 0]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
$

4th step: Configure ALSA

The example below is a configuration that works for my Nuforce Icon HDP which has card number 1 according to the output above. I placed the configuration in ~/.asoundrc By doing this the configuration is only for your user and does not affect the whole system.

This configuration will up-sample all audio to 96/24.

pcm.!default {
  type plug
    slave.pcm "dmixer"
}

pcm.dmixer  {
  type dmix
    ipc_key 1024
    slave {
      pcm "hw:1,0"
        period_time 0
        period_size 1024
        buffer_size 4096
        rate 96000
        format S24_3LE
    }
}

ctl.dmixer {
  type hw
    card 1
}

 Tips and Tricks

DAC not working in ubuntu?

Try to comment out the line “options snd-usb-audio index=-2″ in /etc/modprobe.d/alsa-base.conf. A reboot after doing so might be necessary.

How to find out what sample rates your DAC can process

The capabilities of your DAC can be found in /proc/asound/<your dac>/stream0

$ cat /proc/asound/DAC/stream0 
Nuforce, Inc. Nuforce Icon HDP DAC at usb-0000:00:1a.0-2, full speed : USB Audio

Playback:
  Status: Running
    Interface = 3
    Altset = 2
    URBs = 2 [ 5 6 ]
    Packet Size = 582
    Momentary freq = 96000 Hz (0x60.0000)
  Interface 3
    Altset 1
    Format: S16_LE
    Channels: 2
    Endpoint: 3 OUT (ADAPTIVE)
    Rates: 8000, 16000, 32000, 44100, 48000, 88200, 96000
  Interface 3
    Altset 2
    Format: S24_3LE
    Channels: 2
    Endpoint: 3 OUT (ADAPTIVE)
    Rates: 44100, 48000, 96000
$

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>