Update 1:I added the package dbus-x11 which needs to be manually installed for this to work on a system that has no X server.
Update 2:I added a tunnel setup that I got from a helpful person on pulseaudio's IRC channel.
It may have taken me years, but finally I got around to implementing this and it works, easy. About a decade ago, in the days of OSS I once even tried to export /dev/pcm using NFS.. I know, it was funny though.
Sound Server Setup
I am using a Raspberry Pi that I was offered by a friend
(because I had gotten technically older) but I am sure this should
work with any computer. I am using the default Raspbian image. I
would say you should already have sound working on this computer.
Then install a few new things:
apt-get install pulseaudio
pulseaudio-module-zeroconf avahi-daemon dbus-x11
Then edit /etc/default/pulseaudio and change
PULSEAUDIO_SYSTEM_START from 0 to 1:
Tell PulseAudio to listen (lolpunhaha) to network connections by
adding the following 2 lines to
/etc/pulse/system.pa (adjust the subnet to
whatever you need):
You could either restart PulseAudio or just reboot the whole thing if you're lazy.
As usual I am using Debian, in this case Wheezy, hence maybe a standard Squeeze may not work with this (I haven't tested yet).
We need to change a PulseAudio client preference, and because
this is a desktop I don't mind resorting to a GUI, so I installed
apt-get install paprefs
Run paprefs and under the "Network Access" tab there should be an option called "Make discoverable PulseAudio network sound device available locally", activate that.
Then all is left is to restart PulseAudio on the client. The
easiest way is to reboot the whole system, but really.. really ?
You could just kill and start your PulseAudio session thing:
pulseaudio -k pulseaudio --start
Sound Client 2 - using a tunnel
In some cases the above doesn't work so well, there may be some lag, the server might die, etc. On IRC a very nice human told me I could set up a tunnel from the client to the server. So I did that (with much help). It's now been more than a few months and everything is okay. I had testing versions of Pulseaudio to achieve this (client needs to be version 5+, the server can be older), but since Debian stable is Jessie, everything is back to be being kosher (stable).
In /etc/pulse/default.pa I added (where
192.168.0.1 is the PulseAudio server):
server=192.168.0.1 sink_name=Remote channels=2
rate=44100 This means that we let go of automatic discovery
and tell the client where the server is. I consider this a
workaround for what PulseAudio promises, but in practice this works
well (you just need to keep IPs as static as can be).
No More Playing with Audio Cables !
Now via pavucontrol I can send the sound to the Rapsberry Pi which is connected to the speakers or switch them back to use my laptop's system. Same for the others here, we're all connected to the main speakers, so no need to pass the cable around the table.