PulseAudio actually has great networking capabilities. Especially when combined with Avahi/Zeroconf it is especially easy to set up, though technically it should also be possible without.
- Open /etc/pulseaudio/default.pa
- At the end of the file, add
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;192.168.254.0/24 auth-anonymous=1
to activate networked audio from 192.168.254.0-255 without needing authentication. - Kill pulseaudio, it should be auto-restarted, or restart your login session to activate the changes. You should now be able to set
PULSE_SERVER=192.168.254.XXX
and have the remote audio working! If not check the firewall settings, PulseAudio seems to open a random port by default.
- On both the server and client, install
pulseaudio-module-zeroconf
andavahi
, then after installing make sure Avahi always runs by runningsystemctl enable --now avahi-daemon
- On the server in /etc/pulseaudio/default.pa , add
load-module module-zeroconf-publish
- On the client in /etc/pulseaudio/default.pa , add
load-module module-zeroconf-discover
- Restart pulseaudio and avahi if needed. The remote speakers should now show up in volume control applets like that of KDE, Gnome, or
pavucontrol
and be selectable for output.
- On the server in /etc/pulseaudio/default.pa , remove the
auth-anonymous=1
from the end of the load module line we added. - copy the ~/.config/pulse/cookie file to all other devices you want to use the remote audio on
- in
paprefs
if you have used it, uncheck 'don't require authentication'. - It should now only be available to devices with the cookie available
- https://wiki.archlinux.org/index.php/PulseAudio/Examples
- https://unix.stackexchange.com/questions/470961/how-to-set-up-pulseaudio-remote-properly-and-securely
- https://blogs.gnome.org/ignatenko/2015/07/31/how-to-set-up-network-audio-server-based-on-pulseaudio-and-auto-discovered-via-avahi/
- https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#module-native-protocol-unixtcp
Works as a charm, thanks! Just a small note: You shouldn't kill PA server, rather than restart it by
systemctl --user restart pulseaudio
(without sudo).