December 23, 2014

Fedora audio update

Taking another look at the PulseAudio/ALSA situation, I realised there was still some more tweaking that could be done.

First off, I like the idea of having PulseAudio taking the backseat while handing the reins over to ALSA. So let’s do more of that:

# yum remove alsa-plugin-pulseaudio

With the PulseAudio plugin installed, the default ALSA profile will simply be a dump pipe over to PulseAduio which will then send it back to ALSA. Silly and fairly unecessary sight-seeing tour for audio packages on their way to my headphones. Without the plugin ALSA will once again default to sending things over hw0,0 which in my case does the right thing. Therefore, apart from setting volumes in alsamixer, no further tweaking of ALSA is necessary. Your mileage might vary depending on your audio chipset, driver, current alignment of the stars etc.

Now, we could remove PulseAudio, but that is very messy and not really necessary. Instead we will convert it to a dumb pipe and forward all responsibility to ALSA, who will then forward responsiblity to the hardware.

This means we need to change the default configuration files for PulseAudio a bit.

First of, /etc/pulse/default.pa. This file tells PulseAudio what modules to load, which audio devices to bind etc. By default this file tends to be quite long, but we will nuke it and replace the entire content with this:

#!/usr/bin/pulseaudio -nF

.fail
	# INPUT/RECORD
    load-module module-alsa-source device="default" tsched=1
    
	# OUTPUT/PLAYBACK
    load-module module-alsa-sink device="default" tsched=1
    
    # Accept clients -- very important
    load-module module-native-protocol-unix

.nofail
.ifexists module-x11-publish.so
	load-module module-x11-publish
.endif

This will load the ALSA module and set it up to use the default preset in ALSA, which usually defaults to hw0,0. And sets up the necessary sockets to allow applications to connect to the PulseAudio server, which is necessary if you want to enjoy your tunes in your PulseAudio-only capable media player e.g.

Next we make a small change to /etc/pulse/daemon.conf in order to stop PulseAudio from modifying the Master control in ALSA.

flat-volumes = yes

Now PulseAudio should rarely show up with any real cpu usage, and instead you should see alsa-sink-Multi or something similar be a more active process.

© Sebastian Hörberg 2018

Powered by Hugo & Kiss.