Setup squeezeslave on Intel Atom-based Synology NAS

 

Motivation

It's a very decent feature in Syology's DSM 4.1 having Logitech Media Server at the tip of your finger as an official 3rd party package. It offers the possibility to stream your own music library to any Logitech Squeezebox around your house. In addition, it is controllable by different IR-remotes as well as by very handy Android and iPhone apps.

Yet, Logitech decided to discontinue the whole Squeezebox lineup. That's quite unfortunate, as those devices offered nice build quality together with an amazing centralized setup. But that's not a complete showstopper.

As the whole Squeezebox project is open source, there is a sweet comandline tool called squeezeslave that acts as a software client. It can be run as a daemon on Windows, OS X, Linux, OpenWRT-based routers and several other devices - among them NAS devices. As my Synology NAS sits just next to my stereo, I had the idea of using it as the Squeezebox server as well as a softclient.

Hardware setup

To be able to output sound from the Synology NAS, an external USB sound card is needed. I'm using a Terratec Aureon Dual USB. It features a digital s/pdif output which I was looking for. Any other USB sound card should do just fine, too. When looking for different hardware, it can be helpful to check for OS X-support, as the necessary sound modules for OS X usually derive from Linux - and we need those modules for Linux.

Software prerequisites

In order to be able to stream actual sounds to the USB sound card, some modules and libraries are needed. To install those the Synology box needs bootstraping. This is explained in the earlier article Bootstraping an Intel Atom-based Synology NAS.

After the bootstrapping process is done, the necessary packages can be installed by using the following line:

ipkg install alsa-lib alsa-utils libusb usbutils

Those modules won't load themselves unless you're using Synology's Audio Station package. If so, you need to execute the following lines once:

modules="soundcore.ko snd.ko snd-hwdep.ko snd-page-alloc.ko snd-seq-device.ko snd-timer.ko snd-pcm.ko snd-rawmidi.ko snd-usbmidi-lib.ko snd-usb-audio.ko snd-mixer-oss.ko snd-pcm-oss.ko"
for i in $modules;
do
insmod /lib/modules/$i
done;

The correct setup can be tested by running lsusb which should list your USB sound card. Another good indication for a proper setup is to run alsamixer. It's supposed to show a commandline volume mixer.

Squeezeslave setup

Now that the general conditions are met, squeezeslave itself needs to be set up. The appropriate package can be found on Sourceforge. It is advised to use the lnx24-package of the most recent version (at the time of writing it is v1.2-311). The following lines help doing so. Beware to adjust the respective links and file names to the ones you downloaded.

cd /tmp ; wget "http://downloads.sourceforge.net/project/softsqueeze/squeezeslave/squeezeslave-1.2.311/squeezeslave-1.2-311-lnx24.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fsoftsqueeze%2Ffiles%2Fsqueezeslave%2Fsqueezeslave-1.2.311%2F&ts=1356280037&use_mirror=freefr"
cd /opt/bin; tar xzf /tmp/squeezeslave-1.2-311-lnx24.tar.gz

In order to start squeezeslave on boot, a new start script is necessary. It has to be placed in /opt/etc/init.d/. I named the script S70squeezeslave.

#!/bin/sh

# load sound modules for squeezeslave to work
modules="soundcore.ko snd.ko snd-hwdep.ko snd-page-alloc.ko snd-seq-device.ko snd-timer.ko snd-pcm.ko snd-rawmidi.ko snd-usbmidi-lib.ko snd-usb-audio.ko snd-mixer-oss.ko snd-pcm-oss.ko"
for i in $modules;
do
insmod /lib/modules/$i
done;

# wait a few seconds before starting the squeezeslave daemon
sleep 10
/opt/bin/squeezeslave -N -o0 -R -M/var/log/squeezeslave.log

To make the script executable, run the following:

chmod u+x /opt/etc/init.d/S70squeezeslave

Now, the setup should survive a reboot just fine. If everything worked out a new device called "squeezeslave" should appear in you Logitech Media Server. On your other squeeze devices you should be able to control the output now as if it were any other squeezer.

  1. For beginner to create the file :

    vi /opt/etc/init.d/S70squeezeslave

    paste the script in the terminal, and save by using

    :wq

  2. hi, i followed your explanations but got :
    squeezeslave: error while loading shared libraries: libasound.so.2: cannot open shared object file: No such file or directory

    what should i do ?
    thanks

  3. found !

    had to start squeezeslave this way :
    $env LD_LIBRARY_PATH=/opt/lib /opt/bin/squeezeslave -N -o0 -R -M/var/log/squeezeslave.log

  4. Hi,

    I am on DSM 5.1 and with a DS214play. The command nico suggested did not make the issue go away and I struggle quite a bit to get this script to run on startup. Finally I had to do the following to get it to work:

    1) I copied this file “/root/.profile” that I had previously created (after bootstrapping the NAS) here: /usr/syno/.profile
    2) I added the following lines:

    LD_LIBRARY_PATH=/opt/lib
    export LD_LIBRARY_PATH

    3) I created the S70squeezeslave above script here: /usr/syno/etc.defaults/rc.d/S99squeezeslave.sh

    Thanks for providing guidance on how to setup squeezeslave and the bootstrapping!

Leave a Comment