Installing Squeezelite

First set the sound level:

sudo alsamixer

Use the F6 key to select the right soundcard (I am using an USB soundcard), and then set the volume using the arrow keys.
I also set the microphone volume to zero, to make sure it will not cause interference.

Install some libs:

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

Create a squeezelite “work” directory and download squeezelite:

mkdir squeezelite
cd squeezelite
wget http://squeezelite-downloads.googlecode.com/git/squeezelite-armv6hf

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

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

Because I use a USB soundcard, so I had to tell squeezelite which sound device to use.
First list all the devices:

sudo /usr/bin/squeezelite-armv6hf -l

The result:

Output devices:
null                      - Discard all samples (playback) or generate...
default:CARD=ALSA         - bcm2835 ALSA, bcm2835 ALSA - Default Audio D...
sysdefault:CARD=ALSA      - bcm2835 ALSA, bcm2835 ALSA - Default Audio D...
default:CARD=Set          - C-Media USB Headphone Set, USB Audio - Defau...
sysdefault:CARD=Set       - C-Media USB Headphone Set, USB Audio - Defau...
front:CARD=Set,DEV=0      - C-Media USB Headphone Set, USB Audio - Front...
surround40:CARD=Set,DEV=0 - C-Media USB Headphone Set, USB Audio - 4.0 S...
surround41:CARD=Set,DEV=0 - C-Media USB Headphone Set, USB Audio - 4.1 S...
surround50:CARD=Set,DEV=0 - C-Media USB Headphone Set, USB Audio - 5.0 S...
surround51:CARD=Set,DEV=0 - C-Media USB Headphone Set, USB Audio - 5.1 S...
surround71:CARD=Set,DEV=0 - C-Media USB Headphone Set, USB Audio - 7.1 S...
iec958:CARD=Set,DEV=0     - C-Media USB Headphone Set, USB Audio - IEC95...

The second and third device both will direct the sound to the Raspberry’s default audio output. The quality of that output is not so good, so I used a USB soundcard. My USB soundcard are the rest of the sound devices, recognizable by “C-Media”. My Logilink USB soundcard contains a “C-Media” chip.
I wanted to use only the front speakers, so I had to tell squeezelite to use “front:CARD=Set,DEV=0″ .

Now to start Squeezelite I had to run (ip address is the address of the LMS server):

./squeezelite-armv6hf -o front:CARD=Set,DEV=0 -s

And it worked!

Starting without the IP address for the LMS server:

./squeezelite-armv6hf -o front:CARD=Set,DEV=0

Without the IP address squeezelite uses auto discovery to determine the IP address of the LMS server.

Starting Squeezelite on startup

It was working well, so now I wanted to have it started on startup. So, to automate things, I made a daemon start script to start Squeezelite.

The daemon script uses a seperate script for the settings, called “squeezelite_settings.sh” . I made both scripts available through my website, the next commands download the scripts, move them to the right directory and set the automatic startup:

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
cd /etc/init.d
sudo chmod a+x squeezelite
sudo update-rc.d squeezelite defaults

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:


Change “sysdefault:CARD=ALSA” to the one you selected earlier (in my case I changed it to “front:CARD=Set,DEV=0″).
If you want to use the Raspberry’s default audio output, you don’t have to change it.

The daemon script sets the name of the squeezelite client set to the hostname of the Raspberry. Which is the most logical thing to do, in my opinion.
But if you do want to change it to something else then the hostname, you can set it in the settings script. Open it and search for “SL_NAME” i.
You will find this line:


Remove the hash (“#”), and change the word “Framboos” (=dutch for Raspberry  :) ) to something you like.

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


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

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 ./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):

2324 ?        00:00:01 squeezelite-arm

To stop squeezelite:

sudo ./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 ./squeezelite update

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

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

If you are not using RaspBMC, you can ignore the next section and jump to “Reboot at night”.


Reboot at night

I run my raspberries 24/7, and I discovered that after about two weeks a raspberry can stop responding.
The solution was to restart the raspberry every night at 3 o’clock.
To set this, a cronjob should be used, execute this command:

crontab -e

And add this as the last line:

0 3 * * * sudo /sbin/shutdown -r now

The file is opened in nano so to exit press CTRL-X and save the file.
Now the job is active and the raspberry will perform a reboot at 3 o’clock at night.
If you are not using RaspBMC, you are done now. If you are using RaspBMC, follow the steps in the next section.

Have fun!  8-)

Last update:
20-01-2016 16:24
Karl Hudgell
Average rating:0 (0 Votes)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.

Latest FAQs RSS

  1. Move docker-desktop-data distro out of System Drive (06-01-2022 13:38)
  2. Custom Button Card (23-11-2020 10:02)
  3. NodeJS on Raspberry Pi Zero (12-10-2020 12:47)
  4. Useful Notes (13-11-2019 12:51)
  5. Dockerized Download VM (30-01-2019 20:26)