PulseAudio network sink
This is a simple server, that anyone (!!!, I mean it!) in the network can send music and the server will play it through its speakers. It's a guide for debian, but it applies exaclty the same to other distros (on gentoo you have to recobile pulseaudio with zeroconf use flag for server use and avahi use flag for user).
Pulseaudio needs 2 modules. One to listen over TCP and one to publicate this over avahi (makes it much easier to configure from the user side). You also need avahi-daemon and pulseaudio installed.
Now install the zeroconf/avahi module:
# apt-get install pulseaudio-module-zeroconf
Enable the avahi server:
# systemctl enable avahi-daemon # systemctl start avahi-daemon
Enable the pulseaudio modules, in /etc/pulse/default.pa add these lines:
load-module module-native-protocol-tcp auth-anonymous=1 load-module module-zeroconf-publish
If you need security, take a look at auth-ip-acl, 'cause some ultra-hax0rs are hacking pulseaudio servers to achive world domination through hypnosis. Last, create a service to start on boot and have a beautiful control, create a file in /etc/systemd/system/pulseaudio.service:
[Unit] Description=PulseAudio Server Requires=avahi-daemon.service [Service] Type=forking User=pulse ExecStart=/usr/bin/pulseaudio --start ExecStop=/usr/bin/pulseaudio --kill [Install] WantedBy=multi-user.target
And enable it...
# systemctl enable pulseaudio # systemctl start pulseaudio
The n00bs can configure pulseaudio to passthrough all sound to the server via paprefs.
The real men can either passthrough a specific program to the server via:
$ PULSE_SERVER=<hostname/ip> <command>
Or add the network sink to the local pulseaudio server via:
pacmd load-module module-tunnel-sink server=<hostname/ip>
and do whatever you want with it.