PulseAudio is a standard audio stack used by as good as all Linux distributions. It places itself between end-user software and the kernels ALSA audio stack. It can be used for mixing, per-application volume control and network audio. It has a history of criticism for it's high CPU use and many, many bugs. Most of this was valid from it's creation in 2004 to about 2014. Modern versions are fine and quite useful.
PulseAudio was in 2012 described as:
"Pulse is the single worst Linux move I've ever seen. In the interest of removing audio from the kernel space (necessary for low-latency), it simply eliminated what used to be advanced capabilities. Lennart Poettering, author of Pulse simply disregarded these concerns, waved his hands and said "that's not the concerns Pulse was designed to address!"
Configuration example for (placebo) better audio
PulseAudio is system-wide configured by
/etc/pulse/daemon.conf and this has some settings which may affect audio quality.
These settings may be of interest:
default-sample-rate = 48000 default-sample-format = float32le resample-method = speex-float-10 avoid-resampling = false enable-remixing = yes remixing-use-all-sink-channels = no
You will also want this if you are using a 5.1 surround setup:
default-sample-channels = 6 enable-lfe-remixing = no
But you may want
enable-lfe-remixing = yes
if you are using a stereo setup connected by RCA cables.
The above settings provide the following benefits:
default-sample-ratesets the default sample-rate used by PulseAudio. Modern digital audio equipment can usually handle 48000 just fine. Using 96000 would also be fine.
default-sample-format = float32lesends higher quality samples to ALSA which in turn sends it to the actual audio card. You may not be able to use the better
float32leoption. Run the command
pacmd list-sinks | grep sampleto see what your card(s) actually support.
avoid-resamplingwill, if true, make PulseAudio switch between 48000 and 44100 audio output to the sound device depending on what is being played. This has historically been buggy and problematic when playing say 44100 music in the background and opening a video file that's 48000. Setting this to
falsemakes PulseAudio use the
default-sample-rateeven if it means re-sampling 441000 audio. This is the better choice you will be playing audio from different sources - and you will end up doing that from time to time.
resample-methodsets the type of technology used for resampling.
speex-float-10provides better quality than say
speex-float-2- higher values produce better quality and consume more CPU, lower values have lower quality and consume less CPU. The difference in CPU power required to re-sample audio mattered in 2005. Perhaps it meant something in 2010. It's irrelevant on modern machines.
enable-remixingrefers to re-mixing audio channels. It is useful for remixing mono to stereo. It should be combined with
remixing-use-all-sink-channelsset to true or false decides if stereo should be up-mixed to all channels on a surround system. Setting this to
nomakes it possible to have
enable-remixingset to yes and still have mono up-mixed to stereo.
enable-lfe-remixingrefers to remixing of the sub-woofer channel. Modern surround receivers will typically have a built-in speaker setup where you can configure how many speakers you have. A surround receiver which knows there's 5 speakers and no subwoofer in a 5.1 setup (actually 5.0) will send the LFE sub-woofer channel to the front-speakers.
enable-lfe-remixing=nomay be the better option even if you have no sub-woofer. However, if you are connecting two stereo speakers by RCA then you may want to have pulseaudio convert LFE channel into a part of the stereo signal.
PulseAudio can do Audio over Network
A dedicated machine next to a nice HI-FI surround receiver can run PulseAudio with the following in
/etc/pulse/system.pa if PulseAudio is started as a system user - or
/etc/pulse/default.pa if you start it as a user for some reason - and allow other machines to use it to output audio via this content of
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;10.66.78.0/24;192.168.0.0/24 auth-anonymous=1 load-module module-zeroconf-publish
Make sure the local network subnet you are using is allowed in the
auth-ip-alc= parameter. That parameter can be skipped,
load-module module-native-protocol-tcp auth-anonymous=true would allow everyone access (note that everyone includes remote Internet users if the firewall permits it).
The client(s) on the network would just need the following in
/etc/pulse/default.pa to make a local pulseaudio use a remote pulseaudios outputs - if the client has a working zeroconf setup.
Avahi and systemds resolved are the most commonly used zeroconf-service for automatic discovery.
It is, alternatively, possible to have a line in
/etc/pulse/default.pa which specifies a remote PulseAudio server to use by IP:
load-module module-tunnel-sink server=xxx.xxx.xxx.xxx
(replace xxx.xxx.xxx.xxx with an IP like 192.168.0.2)
Both of the above methods of using a remote PulseAudio instance makes local programs connect to a locally running Pulseaudio instance which has the remote PulseAudio server as one of many possible outputs. Local microphones and local audio outputs are available in addition to the remote servers audio outputs.
Client computers can, alternatively, use a remove pulseaudio server directly by adding a line which says
default-server = ip
That line makes applications connect directly to the remote pulseaudio server. One clear downside with this approach is that local inputs and outputs on the client machine will not be available. Connecting directly to a remote PulseAudio server may be preferable if the local machine/device has no audio devices connected to it.
in bash, pactl info and stat and list will not tell you much if your PA has crashed.