Skip to content

Instantly share code, notes, and snippets.

@nutrino
Forked from xarinatan/networked pulseaudio.md
Created January 17, 2025 06:30
Show Gist options
  • Save nutrino/06b3f080f46172fafe43996825706e6e to your computer and use it in GitHub Desktop.
Save nutrino/06b3f080f46172fafe43996825706e6e to your computer and use it in GitHub Desktop.
How to set up PulseAudio over Network

How to set up PulseAudio over Network

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.

Setting up the server

  • 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.

Setting up automatic configuration and discovery

  • On both the server and client, install pulseaudio-module-zeroconf and avahi, then after installing make sure Avahi always runs by running systemctl 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.

Securing the setup to not allow anonymous logins

  • 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

Sources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment