Multi Room Audio Part 3 – Installing Squeezelite

This is the 3rd part of my quadrology of posts on how to install Logitech Music Server. Since you need a server to work with the clients, I recommend reading the earlier blogs before continuing:

https://wherethingsareborn.wordpress.com/2016/06/04/multi-room-audio-part-2-installing-the-logitech-music-server/

Installing the client software (Squeezelite)

The name of the software client that we will install is called is squeezelite and this is what actually plays the music. In this case I’m going to install the squeezelite client on the same PI as the server but the steps are the same even if installing on a new PI which are

(1) Install the OS

https://wherethingsareborn.wordpress.com/2016/05/09/multiroom-audio-part-2-installing-the-os/

(2) Use raspi-config to set the hostname for the raspberry pi (if you are installing it on the LMS server, then it will be set to something like lmsserver). If using a seperate PI, i would set the hostname to something like “livingroom”, “kitchen” or wherever you plan to place the PI to play the music.

sudo raspi-config

and the go to advanced options and then set hostname.

(3) Install the squeezelite client as follows:

The rest of this section on installing squezzelite is entirely based on the great work done by gerretnl at

TUTORIAL: Installing Squeezelite player on Raspbian

but I would recommend following his blog or this one so you dont get confused.

Install some libraries:

sudo apt-get install -y libflac-dev libfaad2 libmad0

make a work directory for squeezelite and install

cd /home/pi

 

mkdir squeezelite
cd squeezelite
wget -O squeezelite-armv6hf http://ralph_irving.users.sourceforge.net/pico/squeezelite-armv6hf-noffmpeg

 

Move it to the usr directory, and make it executable:

sudo mv squeezelite-armv6hf /usr/bin
sudo chmod a+x /usr/bin/squeezelite-armv6hf

Starting Squeezelite on startup

In order to get the client running at startup execute the following steps:

cd /home/pi/squeezelite
sudo wget http://www.gerrelt.nl/RaspberryPi/squeezelite_settings.sh
sudo mv squeezelite_settings.sh /usr/local/bin
sudo chmod a+x /usr/local/bin/squeezelite_settings.sh
sudo wget http://www.gerrelt.nl/RaspberryPi/squeezelitehf.sh
sudo mv squeezelitehf.sh /etc/init.d/squeezelite
sudo chmod a+x /etc/init.d/squeezelite
sudo wget http://www.gerrelt.nl/RaspberryPi/squeezelite.service
sudo mv squeezelite.service /etc/systemd/system
sudo systemctl enable squeezelite.service
cd /home/pi

You will have to set the soundcard in the settings script.
Open the settings script with nano:

sudo nano /usr/local/bin/squeezelite_settings.sh

And search for this line:

#SL_NAME=”Framboos”

If you are installing squeezelite on the lmsserver, then you can uncomment this line and change it to something like

SL_NAME=”livingroom”

but it you are installing squeezelite on a separate pi then you can leave it alone and it will pickup the default hostname.

Then search for this line:

#SL_MAC_ADDRESS=
and change umcomment it and change it to the actual MAC address of your raspberry PI
in my case
SL_MAC_ADDRESS=”b8:27:xx:xx:15:x”

Save the file at this point.

Hardcoding the MAC address at this point will save you some pain later on as the client seems to pick up the wifi MAC address even if connected via ethernet.

You can figure out which MAC address to use by typing

sudo ifconfig -a | grep Hwaddr

eth0 Link encap:Ethernet HWaddr b8:27:xx:xx:15:xx
wlan0 Link encap:Ethernet HWaddr b8:27:xx:xx:40:xx

 

If the PI is setup to use ethernet then use the eth0 HWaddr, otherwise use the wlan0 HWaddr

If you are using default ALSA output then you may want to use raspi-config to force the audio over HDMI or 3.5mm jackplug (and I dont recommend using the jackplug)

sudo raspi-config
Then select option 9 (advanced options), and then A8 Audio and select force audio to HDMI or jackplug (which ever you are using)
Now you may not be using ALSA at all and may be using a nice DAC. In that case, run the following command:
/usr/bin/squeezelite-armv6hf -l
and this will list the audio outputs available. Make sure that you update the following line in /usr/local/bin/squeezelite_settings.sh
# For alsa (HDMI or 3.5mm
SL_SOUNDCARD=”sysdefault:CARD=ALSA”
# For Pifi DAC
SL_SOUNDCARD=”sysdefault:CARD=sndrpihifiberry”
# For Soundscience QSB speakers
SL_SOUNDCARD=”sysdefault:CARD=QSB”
pifidac and case

Now run alsa-mixer and set the output to about 80%

alsamixer

When you complete this tutorial, and if you experience bad sound quality, or distortion, then open the settings script again and search for this line:

#SL_ALSA_PARAMS="80:::"

And uncomment the line (remove the hash (“#”)), this will increase the output buffer size for squeezelite.

I have mine set as follows:

SL_ALSA_PARAMS=”160:::0″

In the settings script other things can be set too, see the comment for more info.

Save and close the settings script file.

This is how you test the daemon script:

sudo /etc/init.d/squeezelite start

The command prompt should return immediately. Now check if the squeezelite process is up:

ps -A |grep squeeze

It should return something like this (the number will be different):

617 ?   00:45:02 squeezelite-arm

To stop squeezelite:

sudo /etc/init.d/squeezelite stop

You can also update squeezelite with this script. When there is a new version of squeezelite (check on the squeezelite homepage) then execute this command:

sudo /etc/init.d/squeezelite update

This will stop squeezelite, download and update it, and start it again.

And that’s it, you’re done, if you now reboot the raspberry (sudo reboot), squeezelite should be started automatically.

At this point, you can point your webbrowser to the LMS server IP address:9000

Then you can select the 1st client you have installed and try to play some music.

Just repeat the above steps for each additional room you would like to setup.

A little video of it all working

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s