In the previous post PulseAudio was used to give the ability to use the usb soundcard simultaneously by more than 1 process.
PulseAudio has a special feature though (more than one, I know :P) - Acting as a network soundserver for other pulseaudio clients!
So to stick with the previous attempt, now I wanted to play music from my laptop on the NAS - It just took a few steps ;)
#Following has to be done on the NAS
#Install additional package for TCP Streaming/Esound
apt-get install pulseaudio-esound-compat
#Testing loading the modules
pactl load-module module-esound-protocol-tcp auth-anonymous=1
pactl load-module module-native-protocol-tcp auth-anonymous=1
#Both commands should have returned a number, nothin else
#If that's the case - Let's hardcode those modules into the pulse configuration
echo "load-module module-esound-protocol-tcp auth-anonymous=1" >> /etc/pulse/system.pa
echo "load-module module-native-protocol-tcp auth-anonymous=1" >> /etc/pulse/system.pa
That should be all that's neccessary on the server-side :)
Now we look at the client side. I am assuming you already got pulseaudio daemon installed and setup properly for normal usage - click here if you don't.
#Following has to be done on the client side #Connect to the tunnel - 1.2.3.4 is the address of your PulseServer here! pacmd load-module module-tunnel-sink server=1.2.3.4 #The previous command should enable you to redirect all your sound to the NAS already! #I prefered to combine internal and networked-audio though #Find the pulse-sink name of your soundcard pacmd list-sinks |grep name: #Should return something like: name: <
alsa_output.pci-0000_00_1b.0.analog-stereo>
#Note it somewhere #Create combined pulse-sink # * 1.2.3.4 is your server's ip # * alsa_output.pci-0000_00_1b.0.analog-stereo the name of your soundcard pulse-sink pacmd load-module module-combine sink_name=combined slaves="tunnel.1.2.3.4,alsa_output.pci-0000_00_1b.0.analog-stereo" #Now we set it as default sink! pacmd set-default-sink combined #If everything works, we write it to the pulseconfig on the client(s) echo "load-module module-tunnel-sink server=1.2.3.4" >> /etc/pulse/default.pa echo "load-module module-combine sink_name=combined slaves=\"tunnel.1.2.3.4,alsa_output.pci-0000_00_1b.0.analog-stereo\"" >> /etc/pulse/default.pa echo "pacmd set-default-sink combined" >> /etc/pulse/default.pa #Have Phun!
NOTE:
It was necessary to set ICEWEASEL_DSP="none" to "padsp" in /etc/iceweasel/iceweaselrc and restart Iceweasel - to get sound playing from the browser / flash.
Links:
http://wiki.openwrt.org/doc/howto/pulseaudio
http://blog.the-jedi.co.uk/2011/06/26/pulseaudio-on-debian-7/