**Disclaimer**: Don’t try this at home
Sometimes, the best solution isn’t the prettiest.
Sometimes, your server with a few hundred gigs of music is downstairs tucked away in your amazing wireless closet, but you spend most of your life upstairs on your comfiest of couches. Also, living with 5 others, it would be nice to allow your roommates some degree of control over the music.
Our first semi-serious attempt at solving the music-upstairs problem involved an asus eeepc running xmbc with our music hosted on mediatomb upnp shares but we weren’t happy. We decided for practicality reasons we wanted the music to play on the server downstairs, but have the audio play upstairs. However, we weren’t about to mess with the wiring, so we decided on something else…
Piping audio over ssh to a remote machine
while true; do cat /tmp/probedsp done | ssh dsl@probe sox -t raw -r 48000 -w -s -c 2 - -t ossdsp /dev/dsp
That monstrocity is courtesy of John Hawthorn. We’ve had this running almost a month now, and I’m still not sure if its the greatest thing I’ve ever seen, or the most likely to secure us all a place in software hell.
With great power comes great responsibility. We took that responsibility and piped it over ssh through our wireless network 24/7, sucking up more cpu cycles and bandwith a day than every maching running in 1975.
What that command does (at least as far as I can tell…) is pipe the local audio output over ssh to SoX on the remote machine. We’ve set up mpd to output to our fifo (/tmp/probedsp) which gets sent to probe to be played.
When its all said and done, we can control mpd running on our server downstairs, and the audio is played on the tablet upstairs.
Remote Volume Control
To control audio volume, we set up something equally horrifying:
while true do netcat -l -p 1666 | xargs umix done
That sits netcat on port 1666 looking for arguements to send to probe’s mixing program, umix. We can netcat from a local box or open and write to a socket on port 1666 to control the volume…