Perfect audio setup with Slimserver on Debian

Okay, maybe ‘perfect’ is a little strong a term, but it works well enough for me. And I take my music pretty seriously.

Like most people, I have a sizeable collection of CDs. Back in The Day, I even felt like CDs were a blessing, certainly a huge step up from tapes anyway — instantly jump between tracks, no loss of quality over time, cool stuff all over.

Then came mp3s, or more generally speaking, lossy digital audio compression. Roughly at the same time as I was becoming proficient with digital audio encoding (read: I was able to rip my CDs to decent-sounding mp3s), storage was getting ridiculously cheap, to the point that a 160GB external hard drive holding most, if not all, my CD collection was a reasonable purchase on a student budget. Pretty soon, I had it all encoded, and was facing a big problem: my laptop’s speakers.

Now, I live with my girlfriend, and I have a nice, large living room outfitted with a state-of-the-art home theatre system to play my groovy tunes on. Most people would no doubt solve the problem by hooking the headphone jack of a laptop to the tuner, and voilà! you get crappy sound and a not-so-portable-anymore computer. Obviously, I didn’t even bother to try.

Since I had a linux server running in the room already, I figured there had to be a way to use it to play back an audio signal and feed it into the living room HT system. And sure enough, I found a bunch of potential solutions. Since the server has access to the hard drive holding all the music already, it was only a matter of having it run a nice playback server. The basic requirements were:

  • it has to run entirely on the linux system, so we can shutdown/take away the Windows laptops without affecting the music playback. This means there has to be a way to build some kind of playlist.
  • it has to have a nice, easy user interface. I briefly considered manually launching playback via ssh, but figured the WAF would be abysmal.
  • the interface has to be accessible from either of our laptops. A web interface seemed like the most obvious solution, and indeed all the ones I found are web-based.

I don’t recall all the solutions I tried, but the most notable were Ampache and SlimServer, by the makers of the Squeezebox. Both are free software, but for some reason it took me a while to figure out that I could very well use SlimServer without having to fork the cash for a Squeezebox. This is my current setup (Ampache, while entirely functional, didn’t cut it in terms of usability), and what’s cool about it is that if I ever decide to purchase a Squeezebox (it really looks neat) I will hardly have to change anything to my setup since the server is already in place.

Running Slimserver without a Squeezebox

Basically, the Slim Devices solution relies on two components: a computer running Slimserver reads audio files and streams them over the network (wired or wireless) to a Squeezebox, which in turn decodes them to an audio signal which can be then fed into any piece of audio equipment. The trick is that, in addition to a Squeezebox, any computer with audio playback software (Windows Media Player, Winamp, etc.) can tune into a Slimserver and get an audio stream, much like Web radios work. I thus simply replaced the Squeezebox with an audio playback software able to decode an audio stream, and I have it run locally on the same machine. The ‘line out’ jack on the server is connected to the ‘aux in’ on the HT tuner — if the house was any bigger and the server not directly next to the TV/HT system, I probably would have bought a Squeezebox just to avoid all the wiring headaches.

The best playback client I could find for that specific application is slimp3slave, which was incidentally written for the very purpose of locally playing back audio streamed from a Slimserver. It had some issues ‘out of the box’ so after a bit of googling I found that a guy going by the name Stinga has created a patch that made things better. Here is the patched, compiled version of slimp3slave 0.4 ready to be used (again, credit goes to ’stinga’). This script should be given executable rights and placed in the /usr/local/sbin/ directory or another suitable location. I also put together a simple startup script based on the standard Debian template, so that the player can be started/stopped the standard way. This script should go to /etc/init.d/, then a symlink can be made in /etc/rc2.d (or whatever runlevel is needed).

It still has some issues — sometimes the Slimserver reports it doesn’t find the player anymore, even though the daemon still seems to be running on the system. It seems to be totally random, and happens at times when I don’t really have time to diagnose it, but a simple /etc/init.d/slimp3slave restart does the trick. Still have to SSH to the box though, which is annoying — fortunately it doesn’t happen very often.

Since this is the same system running this very blog, it already has a MySQL database server running. An entry on the Slim Devices wiki describes how to use an existing MySQL instance instead of a dedicated one. Always feels good to save some resources.

The end result

Our local installation of SlimserverDespite this minor glitch, we’re pretty happy about the setup. No more getting up to change CDs is definitely a plus, not to mention saving some wear and tear on the CD/DVD player moving parts. We can both control the playlist from our respective laptops, without having any software running locally. As an added and somewhat unexpected bonus, Slimserver also makes it super easy to listen to Web radios on the living room setup — I’ll make a quick plug for my favorite, Lemixx, run from Geneva and easily the grooviest radio on the web.

I currently use a simple RCA analog cable to run the audio signal from the server’s sound card to the HT tuner. Even though it’s using the (presumably crappy) integrated MB audio circuit, the sound is still very crisp and clean, especially with higher-quality mp3s I’ve been creating lately — at least 192kbps VBR, I personally can’t tell the difference from the original CDs and the files are still reasonably small. I initially thought this would be an interim solution until I bought some higher-end sound card or a Squeezebox, but I’m starting to think this would be a waste of money given our current setup and needs.

Leave a Comment

Verification Image

Please type the word you see in the picture.