From ArchWiki
Jump to navigation Jump to search

Merge-arrows-2.pngThis article or section is a candidate for merging with PulseAudio.Merge-arrows-2.png

Notes: Most of the valuable information has been merged; when it is done completely, please redirect this page to PulseAudio#Configuration. (Discuss in Talk:PulseAudio/Configuration#)

Easy configuration

  • paprefs
    • Simultaneous output to all sound cards
    • Network device streaming and discovery (requires Avahi daemon to be installed and running): play sound on any computer on your network from any computer.
  • pavucontrol
    • Per-application volume control
    • Manage input and output devices volumes and outputs
    • Sound card configuration to select input/output ports to use and enable/disable devices
Warning: Do not attempt to change the ALSA configuration files while using the default PulseAudio configuration. The default configuration grabs the hardware devices directly in order to allow all the on-the-fly configurations using the GUIs. Changes to the ALSA configurations will very likely be ignored by PulseAudio and ALSA applications will break randomly while trying to access an ALSA device already used by PulseAudio. If you intend to change the ALSA configurations, also configure PulseAudio manually to output to your own ALSA device and play nice with your configuration.

Advanced configuration

Configuration files


In order to configure the daemon, you will mostly only need the very basic commands:

Basic PA commands
Command Action
load-module module-name option1=value1 option2=value2 Loads a module called module-name with two options called option1 and option2
unload-module 42 or unload-module module-alsa-sink Unloads a module by its index (returned by the load-module command) or all modules by name.
.nofail Allows all commands after this statement to fail without interrupting the script and shutting down the daemon. This is useful when you know some commands could fail and would not affect overall operation, like loading modules for removable devices or network devices that can potentially get unreachable.
.fail Reverse of .nofail: failing commands after this statement will interrupt the script and will cause the daemon to return an error.

There are plenty more commands available that are useful at runtime to control the daemon, see the pactl manpage for more details. Everything that can be made in pavucontrol can also be made on the command line, useful for bash scripts.


Useful client.conf options
Option Description
autospawn If enabled, clients will automatically start PulseAudio if it is not already running when a client attempts to connect to it. This can be useful if you do not want PulseAudio to always be running to conserve system resources. Otherwise, you really should have it start with your X11 session.

Connection & authentication

Since PulseAudio runs as a daemon as the current user, clients needs to know where to find the daemon socket to connect to it as well as a shared random cookie file clients use to authenticate with it. By default, clients should be able to locate the daemon without problem using environment variables, X11 root window properties and finally by trying the default location (unix:/run/user/$ID/pulse/native). However, if you have clients that needs to access PulseAudio outside of your X11 session like mpd running as a different user, you will need to tell it how to connect to your PulseAudio instance. See PulseAudio/Examples#Allowing multiple users to use PulseAudio at the same time for a complete example. An authentication cookie containing random bytes is enabled by default to ensure audio does not leak from one user to another on a multi-user system. If you already control who can access the server using user/group permissions, you can disable the cookie by passing auth-cookie-enabled=0 to module-native-protocol-unix.

Environment variables

These two variables are the important ones in order for libpulse clients to locate PulseAudio if you moved its socket to somewhere else. See pulseaudio(1) for more details and other useful environment variables clients will read.

Variable Definition
PULSE_SERVER Defines where the server is. It takes a protocol prefix like unix: or tcp followed by the path or IP of the server. Example: unix:/home/pulse/native-sock.
PULSE_COOKIE Point this to the location of a file that contains the random cookie generated by PulseAudio. This file will be read by clients and its content sent to the server, thus the file has to be readable by all audio clients. It does not need to be the same file, as long as its content matches the one the daemon uses.

X11 properties

PulseAudio also uses window properties on the root window of the X11 server to help find the daemon. Since environment variables cannot be modified after child processes are started, X11 properties are more flexible because they are more easily changed because they are globally shared. As long as applications receive a DISPLAY= environment variable, it can read the most up-to-date values. X11 properties can be queried using xprop -root, or with pax11publish -d to read pulse-specific properties. pax11publish can also be used to update the properties from environment variables (pax11publish -e, or pax11publish -r to remove them entirely). If possible, it is recommended to let PulseAudio do it by itself using the module-x11-publish module or the start-pulseaudio-x11 command. The following table is there only for completeness, you should not ever need to manually set these variables by hand.

Variable Definition
PULSE_SERVER String value (xprop -root -f PULSE_SERVER 8s -set PULSE_SERVER "unix:/tmp/pulse-sock"), works the same as the environment variable of the same name.
PULSE_COOKIE String value that contains the hexadecimal representation of the authentication cookie.



Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: Local sound, network sound, file sounds, streaming servers (Discuss in Talk:PulseAudio/Configuration#)


Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: TODO: Explain both static ALSA configuration and automatic detection. How to use ALSA plugins. Mention that PulseAudio likes real hardware way better than plugins for latency and power-saving controls (Discuss in Talk:PulseAudio/Configuration#)


Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: Jack auto-detection or static Jack client (Discuss in Talk:PulseAudio/Configuration#)

Filters & Routing

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: Collection of useful modules for audio processing (EQ) and routing (combining card, splitting cards, imitating JACK features (Discuss in Talk:PulseAudio/Configuration#)