User avatar
Gerrelt
Posts: 294
Joined: Sat Nov 10, 2012 9:01 am

[Tutorial] Squeezelite up and running on Raspbian

Sat Dec 15, 2012 8:39 pm

edit 16 march 2014:

Squeezelite is a software version of the Logitech Squeezebox. A squeezebox can connect to a Logitech Media Server (LMS). This server streams music to the players.
Internet radio, MP3's and I believe even Spotify is possible.

Also it's possible to synchronize playes, to create a multi room sytem. Which was my goal actually. I have a raspberry in the living room and one in the kitchen and these two are synchronized.
And I've got squeezelite running on a raspberry, which I turned into a portable squeezelite player with retro looks (see this thread).

I have created a Tutorial on how to setup the raspberry as a Squeezebox player:

For easier editing, I have moved this tutorial to a webpage, see:
http://www.gerrelt.nl/RaspberryPi/wordp ... -raspbian/
If you have any questions, remarks or suggestions, please keep using this thread.

Greetings,

Gerrelt.
Last edited by Gerrelt on Tue May 06, 2014 8:19 pm, edited 40 times in total.
my Raspberry Pi page: http://raspberry.gerrelt.nl

Frenchy
Posts: 11
Joined: Tue Jan 22, 2013 2:58 pm

Re: Squeezelite up and running on Raspian Wheezy Hard Float

Sun Jan 27, 2013 5:58 pm

Hi Gerrelt,

Thanks for your helpful tutorial!
It was my first steps with linux and I succeeded to install squeezelite on raspbian.
I just found 2 little errors ;)


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

I have 3 USB DAC and I’d like to start 3 squeeze lite session as the RPI starts. I’ve downloaded your script and need some help to adapt it…
Can-you help-me and tell-me which parts needs to be updated?

Can I simply copy/paste this line (and create differentes params)

Code: Select all

start-stop-daemon --start --quiet --make-pidfile --pidfile $PIDFILE --background --exec $DAEMON -- $DAEMON_ARGS -m $SLMAC || return 2
Thanks,

Frenchy

User avatar
Gerrelt
Posts: 294
Joined: Sat Nov 10, 2012 9:01 am

Re: Squeezelite up and running on Raspian Wheezy Hard Float

Sun Jan 27, 2013 8:00 pm

Hi Frenchy,

I'm glad you found it usefull. 8-)

Ah, yes, there should be "hf" added in the instructions. Sadly, I'm not allowed to edit the post anymore, because of forum rules.
EDIT 9 july 2013: I've now got the right to edit my old posts, so I changed it. 8-)

I hope everybody reads your post so they know how to correct it.

About adding the lines to the daemon script:
I think it would be simpler to copy the script two times, and change the scripts. Then make the other scripts start at startup too.
Like this:

Code: Select all

cd /etc/init.d
cp squeezelite squeezelite_dac2
cp squeezelite squeezelite_dac3
sudo chmod u+x squeezelite_dac2
sudo chmod u+x squeezelite_dac3

Then edit the two new scripts to make them use the different dacs:

Code: Select all

sudo nano squeezelite_dac2
sudo nano squeezelite_dac3
And then make them start when the raspberry boots:

Code: Select all

sudo update-rc.d squeezelite_dac2 defaults
sudo update-rc.d squeezelite_dac3 defaults
Be aware: Because you are starting three squeezelite isntances you must assign different mac addresses to them.
In each script change this line (at linenumber 40):

Code: Select all

SLMAC="00:00:00:00:00:01"
So it contains a unique mac address. For example, use: 00:00:00:00:00:01, 00:00:00:00:00:02 and 00:00:00:00:00:03

If you don't do that, then the LMS server cannot identify the players seperately. As soon as the second player instance becomes active, it will "overwrite" the previous one with the same mac address.
Assigning different mac addresses to them prevents this from happening.
Last edited by Gerrelt on Tue Jul 09, 2013 7:14 pm, edited 1 time in total.
my Raspberry Pi page: http://raspberry.gerrelt.nl

Frenchy
Posts: 11
Joined: Tue Jan 22, 2013 2:58 pm

Re: Squeezelite up and running on Raspian Wheezy Hard Float

Mon Jan 28, 2013 9:31 pm

Thanks for your help.

Unfortunately, the second instance doesn't want to start...no error message to tell-me why :(

When I executed this line

Code: Select all

sudo update-rc.d squeezelite_dac2 defaults
I had an error telling me that squeezelite service was already registered.

So I updated this line

Code: Select all

# Provides:          squeezelite
into

Code: Select all

# Provides:          squeezelite2
Then I executed again the

Code: Select all

sudo update-rc.d squeezelite_dac2 defaults
and got no error.

When the RPI starts, It only start the first instance of Squeezelite (and It working well)

If I manually start the second instance:

Code: Select all

sudo ./squeezeliteDAC2 start
No error...but nothing started...

How can I debug this?

I also tried

Code: Select all

ps -A |grep squeeze
And It returned one line...

Do-you have any idea where could b the problem?
Have-you tried multiple instance of squeezelite?

Thanks for your time,

Frenchy

User avatar
Gerrelt
Posts: 294
Joined: Sat Nov 10, 2012 9:01 am

Re: Squeezelite up and running on Raspian Wheezy Hard Float

Mon Jan 28, 2013 11:14 pm

No I didn't try it myself. But, looking at the script, I think you should change this line (line 36):

Code: Select all

PIDFILE=/var/run/$NAME.pid
And change it so it's unique to the dac the script is for.
For example, for squeezeliteDAC2 you could change it to:

Code: Select all

PIDFILE=/var/run/$NAME_dac2.pid
The PIDFILE is the file where the process id is stored for this daemon. The proces ID is the number you see when you execute
this command:

Code: Select all

ps -A |grep squeeze
The PIDFILE is used to check if the process is allready running, and to make the daemon stop it's process.
Currently alle the scripts use the same PIDFILE name, which cannot work. So you got to make it unique for each script.
my Raspberry Pi page: http://raspberry.gerrelt.nl

Frenchy
Posts: 11
Joined: Tue Jan 22, 2013 2:58 pm

Re: Squeezelite up and running on Raspian Wheezy Hard Float

Wed Jan 30, 2013 11:27 am

YES It works :mrgreen:

One thing I don't understand;

Code: Select all

PIDFILE=/var/run/$NAME_dac2.pid
$NAME_dac2 => this variable isn't initiated at anytime...is It normal?
It's working but don't understand how

User avatar
Gerrelt
Posts: 294
Joined: Sat Nov 10, 2012 9:01 am

Re: Squeezelite up and running on Raspian Wheezy Hard Float

Wed Jan 30, 2013 12:14 pm

Nice! 8-)

A few lines above it, there this line:

Code: Select all

NAME=squeezelite-armv6hf
So, variable $NAME will have value "squeezelite-armv6hf".

PIDFILE will therefore evaluate to "/var/run/squeezelite-armv6hf_dac2.pid" in your example.

To check, execute this command while your squeezelite daemons are running:

Code: Select all

sudo ls /var/run/squeezelite-armv6hf*.pid
It should display 3 entries.
my Raspberry Pi page: http://raspberry.gerrelt.nl

Frenchy
Posts: 11
Joined: Tue Jan 22, 2013 2:58 pm

Re: Squeezelite up and running on Raspian Wheezy Hard Float

Wed Jan 30, 2013 2:51 pm

Okaaayy

I'm from the Microsoft .NET world :oops:
That's really different....

So you can concatenate a variable to a string without giving any "",+,...or anything
That's strange. i'll remember it

User avatar
Gerrelt
Posts: 294
Joined: Sat Nov 10, 2012 9:01 am

Re: Squeezelite up and running on Raspian Wheezy Hard Float

Wed Jan 30, 2013 8:05 pm

I am currently in the .NET world too. :)
But in my previous job I worked with Oracle, Java and unix servers, so I have done some scripting too.

Remember, this is just a script and not a "real" programming language.. ;)
As long as you don't create a variabel with the name "NAME_dac2" this will work fine.
But even if you do, you probably could solve it by using { }.
Like this: PIDFILE=/var/run/${NAME}_dac2.pid

It might even be recommended to do it like that.
my Raspberry Pi page: http://raspberry.gerrelt.nl

Frenchy
Posts: 11
Joined: Tue Jan 22, 2013 2:58 pm

Re: Squeezelite up and running on Raspian Wheezy Hard Float

Mon Feb 04, 2013 7:40 pm

I'm back...I juste received my 3rd DAC and It doesn't want to start during the boot process.

I exactly did the same as for DAC2...but It doesn't start :?

So I tried to start it manually:

Code: Select all

sudo squeezelite-armv6hf -o front:CARD=DAC_2,DEV=0 -m 00:00:00:82:84:56 -n SqueezeC 192.168.1.200 -z
OK It works

Then I tried to run the "daemonized"

Code: Select all

sudo ./squeezeliteDAC3 start
No It doesn't start :cry:

Then I checked in the logs (/var/log/); no file "squeezeslite.log"

I triple checked the init.d/squeezeliteDAC3 file...so I really don't know why It doesn' start.

Is there a way to debug it? or to get some logs...

Thanks

User avatar
Gerrelt
Posts: 294
Joined: Sat Nov 10, 2012 9:01 am

Re: Squeezelite up and running on Raspian Wheezy Hard Float

Mon Feb 04, 2013 9:00 pm

Hmm...just had a look at the script again.. it seems the logging is totally absent. Yes, there is a variable SLLOG defined, but it doesn't do anything with it.

You could put in some debug messages like:

Code: Select all

echo The scrip is doing this  >> ${SLLOG}
Can you PM me the script for DAC3 ?
my Raspberry Pi page: http://raspberry.gerrelt.nl

Frenchy
Posts: 11
Joined: Tue Jan 22, 2013 2:58 pm

Re: Squeezelite up and running on Raspian Wheezy Hard Float

Tue Feb 05, 2013 8:45 pm

Yep I've sent you the script in PM.

Another (little) problem is that radio and apps only work on one out of 3 DACs (music works on the 3 DACs).

Nothing to do, when playing radio, the sounds only works with one DAC...
I also tried to sync the players (wich works with music) and same problem, the sound only comes out from one player...

castalla
Posts: 558
Joined: Thu Jul 19, 2012 3:46 pm

Re: Squeezelite up and running on Raspian Wheezy Hard Float

Wed Feb 06, 2013 7:02 pm

Followed you instructions to install squeezelite on Raspian (but on a Cubieboard, not a Pi).

Seems to go all okay until the -o output options.

As far as I can see this version of Raspian is set up to use PulseAudio (aaargh!). ... I've no idea how to handle that.

If I post the squeezelite -l & aplay -L listings - do you think you can help?

I imagine I'll have to get rid of pulseaudio to get anywhere.

User avatar
Gerrelt
Posts: 294
Joined: Sat Nov 10, 2012 9:01 am

Re: Squeezelite up and running on Raspian Wheezy Hard Float

Wed Feb 06, 2013 8:55 pm

Frenchy wrote:Yep I've sent you the script in PM.

Another (little) problem is that radio and apps only work on one out of 3 DACs (music works on the 3 DACs).

Nothing to do, when playing radio, the sounds only works with one DAC...
I also tried to sync the players (wich works with music) and same problem, the sound only comes out from one player...
So, playing MP3's through LMS - Squeezelite works, but playing radio through LMS - squeezelite does not work correctly? Hmm..strange.. :?
Did you try the modified script I send you? It could be a problem with the way you add the Mac addres to squeezelite.
castalla wrote:Followed you instructions to install squeezelite on Raspian (but on a Cubieboard, not a Pi).

Seems to go all okay until the -o output options.

As far as I can see this version of Raspian is set up to use PulseAudio (aaargh!). ... I've no idea how to handle that.

If I post the squeezelite -l & aplay -L listings - do you think you can help?

I imagine I'll have to get rid of pulseaudio to get anywhere.
I know nothing about Cubieboards or PulseAudio. But I am curious about the squeezelite -l listing. Yes, post it.
my Raspberry Pi page: http://raspberry.gerrelt.nl

castalla
Posts: 558
Joined: Thu Jul 19, 2012 3:46 pm

Re: Squeezelite up and running on Raspian Wheezy Hard Float

Wed Feb 06, 2013 9:14 pm

Here's the output:

Code: Select all


pi@raspberrypi ~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sun4isndhdmi [sun4i-sndhdmi], device 0: SUN4I-HDMIAUDIO sndhdmi-0 []
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 1: sun4icodec [sun4i-CODEC], device 0: M1 PCM [sun4i PCM]
  Subdevices: 0/1
  Subdevice #0: subdevice #0


pi@raspberrypi ~ $ squeezelite-armv6hf -l
Output devices:
  null                           - Discard all samples (playback) or generate zero samples (capture)
  pulse                          - Playback/recording through the PulseAudio sound server
  sysdefault:CARD=sun4isndhdmi   - sun4i-sndhdmi,  - Default Audio Device
  sysdefault:CARD=sun4icodec     - sun4i-CODEC, sun4i PCM - Default Audio Device

pi@raspberrypi ~ $
The output from a test:

Code: Select all


pi@raspberrypi ~ $ aplay tada.wav
Playing WAVE 'tada.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
aplay: pcm_write:1710: write error: Input/output error
pi@raspberrypi ~ $

User avatar
Gerrelt
Posts: 294
Joined: Sat Nov 10, 2012 9:01 am

Re: Squeezelite up and running on Raspian Wheezy Hard Float

Wed Feb 06, 2013 9:23 pm

Dit you try this as -o setting? :

Code: Select all

SLOPTIONS="-o sysdefault:CARD=sun4icodec -n Framboos"
Or this one, but that's probably for the HDMI output:

Code: Select all

SLOPTIONS="-o sysdefault:CARD=sun4isndhdmi -n Framboos"
my Raspberry Pi page: http://raspberry.gerrelt.nl

castalla
Posts: 558
Joined: Thu Jul 19, 2012 3:46 pm

Re: Squeezelite up and running on Raspian Wheezy Hard Float

Wed Feb 06, 2013 9:39 pm

Looks like the audio is not configured properly - I've got a different Debian image where I know the onboard audio does actually play, so I'll try that.

I'll also have a bash at uninstalling Pulseaudio ...

Will report back here on progress - thanks for the help

Code: Select all

pi@raspberrypi /usr/bin $ squeezelite-armv6hf -o sysdefault:CARD=sun4icodec -n Framboos
[22:31:41.309293] test_open:152 playback open error: Device or resource busy
[22:31:41.310142] output_init:1336 unable to open output device
pi@raspberrypi /usr/bin $

castalla
Posts: 558
Joined: Thu Jul 19, 2012 3:46 pm

Re: Squeezelite up and running on Raspian Wheezy Hard Float

Wed Feb 06, 2013 9:52 pm

Bingo!

Removing Pulseaudio seems to have worked!

At least I can see Framboos in Squeezeplay and control streams, etc. Now to actually plug in a speaker!

cheers

perplu
Posts: 11
Joined: Sun Feb 24, 2013 4:30 am

Re: Squeezelite up and running on Raspian Wheezy Hard Float

Sun Feb 24, 2013 4:38 am

Have put all the test information below only as additional context. TEST 3 below is a working solution for synchronised music play-back to multiple audio devices running Squeezelite.

The only issue noted is that the volume is much quieter in TEST 3 than in TEST 2. Don't quite know why this was. Will need to investigate. But - the solution seems to be use Squeezelite, Raspberry PI stuck on the back of powered speakers in each room of the house. The ony down-side is the Squeeze Server interface could do with a refresh - its a bit tired. Useful also is that there are two android apps that are OK for use as a remote control.

SETUP:
DS 109+
All music FLAC.

AIRPLAY TEST:
Three airplay receivers setup:
- Android 2.3 with AirBubble
- Shairport on Raspberry PI - http://jordanburgess.com/post/389864343 ... pi-airplay
- Windows 7 Laptop with Shairport4W

TEST 1:
Played to all from DS Audio.
No music played; Raspberry crashes.

TEST 2:
Played simultaneously to all from MusicBee with Remote Speakers Out add-in installed and all three airplay receivers selected.
Music played OK, but not in sync.

SQUEEZE-SERVER TEST:
Two squeeze receivers setup:
Squeezelite on Windows 7 Laptop.
Squeezelite on Raspberry PI http://www.raspberrypi.org/phpBB3/viewt ... 38&t=25778 . Audio was out via Raspberry HDMI port to Onkyo receiver.

TEST 3:
Played same track simultaneously from DS NAS Squeeze and all in sync to both Squeeze receivers. Could also play to multiple audio devices the same track synchronised using either of two android apps on my smartphone running android 2.3.

perplu
Posts: 11
Joined: Sun Feb 24, 2013 4:30 am

Re: Squeezelite up and running on Raspian Wheezy Hard Float

Sun Feb 24, 2013 8:18 am

I should add - if you use active speakers with an internal DAC you can presumably hook them up directly to the RPi USB in some cases or just need to get an HDMI to TOSLINK converter thing. Better yet would be an active speaker with internal DAC that also has an HDMI in. But some digital speakers I've found are:

http://www.aktimate.com.au/mini+.html
http://www.vanatoo.com/ - this one has USB in. But before buying I'd want to know if it would work from RPi to USB in on the speakers. I'm guessing if there's anything that needs tweaking it will be with the RPi USB setup.

Just found this - http://www.samsung.com/us/video/home-theater/HW-D551/ZA
I'm guessing the other major audio-visual manufacturers make soundbars now - and I'm guessing they'll all have an HDMI in. If you have somewhere you can hide the speaker - then this is probably the best lowcost option. The speakers are pretty reasonable - their competitors are likely the same.

perplu
Posts: 11
Joined: Sun Feb 24, 2013 4:30 am

Re: Squeezelite up and running on Raspian Wheezy Hard Float

Mon Mar 11, 2013 7:26 am

The other thing I've just realised is that there are dozens of speakers out there with an HDMI-in. All the soundbars from Sony, Phillips, Panasonic etc. Some have wireless subs and some have not sub. The setup I plan to end up with is PC upstairs with SqueezeLite which is connected to upstairs amp and speakers; downstairs amp and speakers connected to RPI via HDMI, soundbar in kitchen above cupboards where you won't see it connected to PRI via HDMI and then somehow put a soundbar in the bathroom connected to RPI via HDMI. All in sync. Yay.

I have a Synology diskstation which has the latest DMS on it which while it plays the same track to multiple airplay devices the output is not always in sync. The only options to get them in sync is either Porthole software or Airfoil speakers - both of which means I'd either need to find a way to install them on the Synology NAS (linux) which I don't know how to port and do; or I need to set up a separate intel box alongside the NAS running Airfoil or Porthole - which I'm tempted to do and then I can just buy any airplay speakers and forget the whole rapsberry thing. Food for thought.

00Luke
Posts: 1
Joined: Tue Mar 19, 2013 9:36 pm

Re: Squeezelite up and running on Raspian Wheezy Hard Float

Tue Mar 19, 2013 9:42 pm

Hello,

Thanks so much for this great tutorial and start up script!

I've just run through it all and it's working great when I start ./squeezelite-armv6hf manually, but when I try to get your auto start up script working I'm struggling.

I've installed and edited it as advised, but when I try and run it, it seems to do nothing. If I run ps -A |grep squeeze I get nothing coming back, and /etc/init.d $ sudo ./squeezelite status returns:
[FAIL] squeezelite-armv6hf is not running ... failed!

Any tips or advice? If there's any other information you need please let me know - I'm really knew to all this so still learning what's useful / important and what isn't :)

Cheers!

perplu
Posts: 11
Joined: Sun Feb 24, 2013 4:30 am

Re: Squeezelite up and running on Raspian Wheezy Hard Float

Wed Mar 20, 2013 2:43 am

These links should be helpful. One is for getting VNC to start on start-up, just follow the same instructions but replace VNC stuff with SqueezeLite stuff.

http://myraspberrypiexperience.blogspot ... cally.html

http://danielmuller.asia/2013/02/squeez ... spberrypi/

Cheers.

User avatar
Gerrelt
Posts: 294
Joined: Sat Nov 10, 2012 9:01 am

Re: Squeezelite up and running on Raspian Wheezy Hard Float

Fri Mar 22, 2013 6:54 pm

@perplu: I searched around for pc speakers with HDMI input, but I couldn't find affordable ones. I think it's too soon for HDMI input PC speakers.

@00Luke: How do you try to start it? What is the command line, and in which directory are you in when starting it?
my Raspberry Pi page: http://raspberry.gerrelt.nl

fab-s
Posts: 1
Joined: Tue Jun 11, 2013 10:19 pm

Re: Squeezelite up and running on Raspian Wheezy Hard Float

Tue Jun 11, 2013 10:23 pm

I got it running but with bad sound quality, kind of distorted. Turns out that you need to increase the output buffer size

Code: Select all

-a 80
See this bug report: http://code.google.com/p/squeezelite/is ... tail?id=28

Return to “Graphics, sound and multimedia”