Configuring Pulse-audio to use a remote server

Let’s Start with some definitions:
Server: The computer that receives the audio and have the speakers connected.
Client: The computer that generates the audio and send it via the network.
 
On the server side you’ll need to enable the ‘module-native-protocol-tcp’ pulse-audio module, this module usually is already installed by but for security reasons it comes as disabled by default.
You’ll also need to open port tcp/4713 on your firewall.
After that you need to copy the file ‘~/.pulse-cookie’ from the server to every client.
Now that you synced the pulse-cookie file choose your authentication method used by the ‘module-native-protocol-tcp’ and edit the file ‘/etc/pulse/default.pa’.
 
If you want to let anyone with the right pulse-cookie file to connect and send audio:


    load-module module-native-protocol-tcp auth-anonymous=1 

 
Or a more secure approach is authentication with pulse-cookie and IP address or Network, if you have multiple clientes you just need to input a list separated by a semicolon:


    load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;<CLIENT_IP_OR_CLIENT_NETWORK>

 

On the client side, you can test your server configuration with the following:


    PULSE_SERVER=<SERVER_IP> pavucontrol

 
After making sure it works, you can make the modification permanent by editing the /etc/pulse/client.conf just add or edit the following line


    default-server = <SERVER_IP>

 

Caveats:

This method sends raw PCM audio through the network so it uses a fair bit of bandwidth and is really latency sensitive so for the best experience it’s better for the client and server to be on a wired network.
It’s also important to have a fixed internal IP address, or better yet an internal DNS name, for the server and all clients if you don’t you’ll need to update the configuration files with the new IP addresses when they change.
In a more complex/exotic setup with multiple servers and/or clients you’ll get better performance by utilizing the RTP module but it’s beyond the scope of this tutorial.

Sources:

https://wiki.archlinux.org/index.php/PulseAudio/Examples

https://wiki.archlinux.org/index.php/PulseAudio#Networked_audio

https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/ServerStrings/