Disable PulseAudio and switch to ALSA

I have a computer in my living room PulseAudio. As is typical with Poettering software, PulseAudio is very unpredictable.

Within the Ubuntu settings editor, there is no way to permanently choose an audio device. Every time I reboot this computer, and sometimes when suspending, it reverts from HDMI to Analog. Within pavucontrol, you can set the default device but it doesn’t stick anyway. I suppose this has to do with the timing of HDMI audio device being detected as plugged in or some such malfunctioning automagic bullshit.

It’s highly annoying to change the audio device all the time, so here is how I got around this issue.

Disable PulseAudio

Strictly speaking, it is not disabled. Not in the sense of turning if off with systemctl, this just stops the binary from running, apparently:

mr@tvpc:~$ systemctl --user status pulseaudio
● pulseaudio.service - Sound Service
   Loaded: loaded (/usr/lib/systemd/user/pulseaudio.service; di
   Active: inactive (dead)
mr@tvpc:~$ systemctl --user status pulseaudio.socket
● pulseaudio.socket - Sound System
   Loaded: loaded (/usr/lib/systemd/user/pulseaudio.socket; dis
   Active: inactive (dead)
   Listen: /run/user/1000/pulse/native (Stream)

Like any software of this uh .. caliber, I have never found any official documentation particularly useful. However the Kodi documentation came in handy https://kodi.wiki/view/PulseAudio/HOW-TO:Disable_PulseAudio_and_use_ALSA(without_removing_PulseAudio)_for_Ubuntu

The relevant bit, in /etc/pulse/client.conf :

autospawn = no

ALSA Default Device

mr@tvpc:~$ aplay -l 
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC662 rev1 Analog [ALC662 rev1 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

The device I’ll be using is Card 0, Device 3. So, in /etc/asound.conf:

pcm.!default {
        type hw
        card 0
        device 3
}

ctl.!default {
        type hw
        card 0
        device 3
}

After a reboot, no audio devices show up in the Ubuntu Settings app.

Firefox

I like Firefox. Sadly, guess what? Apparently the Linux version of Firefox requires PulseAudio and cannot use Alsa as of many versions ago. https://support.mozilla.org/en-US/questions/1199433

So, I guess it’s time to change browsers. Chromium seems to work fine with Alsa without any fuss, so there you go.