Setting the default ALSA device for Pulseaudio

Answering the two questions:

You can select the default device in PulseAudio with a GUI like the GNOME volume control, pavucontrol, or from the command line using pacmd set-default-sink.

By default, PulseAudio opens devices for 44.1 kHz or 48 kHz, whichever leads to lower resampling effort (so 96 kHz audio would usually lead to the device being opened at 48 kHz. Also, we open the devices for S16LE by default.

Now, you have two options. If you just want to play a few files at their native format, paplay --passthrough <file> should do the job for you. You can even specify which device to use.

The other option is to globally make PA use 96/24. You can change that in /etc/pulse/default.conf (alternate-sample-rate = 96000, default-sample-format=s24-32le). This will lead to greater CPU usage, though. This is a bit of a silly situation, having to apply global configuration for all devices. We're planning to add per-device configuration at some point.

Note, after this, you should just use mplayer's PulseAudio backend rather than have mplayer talk to ALSA and then ALSA to PulseAudio. You can do that with mplayer -ao pulse ... and if you want to set it up permanently, add ao=pulse to ~/.mplayer/config.


After the update to 13.10 Pulseaudio defaulted to HDMI, probably because I have an extra monitor attached to my laptop (Lenovo T430S) thru my mini-display port. The archlinux website provided a sweet and short answer to reset or set the default:

  • login and change the default output to analog

  • Run

    $ aplay -l

and find that analog is card 0

  • Run

    $ pacmd list

and find the line:

active profile: <output:analog-stereo+input:analog-stereo>

"output:analog-stereo+input:analog-stereo" is my profile name, so add

set-card-profile 0 output:analog-stereo+input:analog-stereo

in /etc/pulse/default.pa and save

  • restart pulseaudio

The sample format used in the interface between applications and PulseAudio is not always directly related with the sample format that PulseAudio uses to access the hardware device.

S24_3LE is not one of PulseAudio's supported application formats (as shown in the aplay output). To allow applications with such unusual formats to run with PulseAudio, add a plugin that does automatic format conversion if need for the default PCM device in your .asoundrc:

pcm.!default {
    type linear
    slave.pcm pulse
}

Just a quick workaround I found out using Lubuntu Trusty Tahr with my Fiio E17 connected via USB: I was also wondering about the bitrate, that's why i found this posts here. But since I listen to music on a rather old Netbook, I did not want to set it to 96/24 by default (cpu is not the fastest) However, what worked for me was to use VLC, and specify in the expert audio settings to use the ALSA module for output, and then use the following output device: "Fiio USB DAC-E17, USB Audio Direct hardware device without any conversions"

This way, i was able to output 96/24 sound to the Fiio over USB when I wanted (also shows on the little screen of the Fiio) - and i did not have to change something more fundamental in the OS. Players like audacious or the browsers still use the default pulseaudio output. Sometimes VLC says that the device is already being used - then just close any other software like audacious, that is using e.g. the pulseaudio output, and it should work.

regards, Andi