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

Re: [Tutorial] Squeezelite up and running on Raspbian

Sun Jan 10, 2016 9:00 am

There seems to be a left-over .pid file, maybe from your previous tests.

Just remove it:

Code: Select all

sudo rm /var/run/squeezelite-armv6hf.pid
And try again. I think you are on the right path with the "running damon as pi" setting.

Greetings,
Gerrelt.
my Raspberry Pi page: http://raspberry.gerrelt.nl

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

Re: [Tutorial] Squeezelite up and running on Raspbian

Sun Jan 10, 2016 9:45 am

Wait... there is something strange with your systemctl output.

Yours shows this line:

Jan 09 10:17:29 raspberrypi squeezelite[511]: Starting: /usr/bin/squeezelite-armv6hf -n Zentrale_Test

This is my complete output:

Code: Select all

pi@2-Blueberry-Keuken:~ $ sudo systemctl status  -l squeezelite.service
● squeezelite.service - Squeezelite LMS player
   Loaded: loaded (/etc/systemd/system/squeezelite.service; enabled)
   Active: active (running) since Sun 2016-01-10 03:00:29 CET; 7h ago
  Process: 501 ExecStart=/etc/init.d/squeezelite start (code=exited, status=0/SUCCESS)
 Main PID: 565 (squeezelite-arm)
   CGroup: /system.slice/squeezelite.service
           └─565 /usr/bin/squeezelite-armv6hf -o equal -n 2-Blueberry-Keuken -m b8 27 aa 78 aa 8a -s 192.168.10.99

Jan 10 03:00:27 2-Blueberry-Keuken sudo[539]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/squeezelite-armv6hf -t
Jan 10 03:00:27 2-Blueberry-Keuken sudo[539]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jan 10 03:00:27 2-Blueberry-Keuken sudo[539]: pam_unix(sudo:session): session closed for user root
Jan 10 03:00:28 2-Blueberry-Keuken squeezelite[501]: Starting: /usr/bin/squeezelite-armv6hf  -o equal -n 2-Blueberry-Keuken -m b8:27:aa:78:aa:8a -s 192.168.10.99
Jan 10 03:00:28 2-Blueberry-Keuken squeezelite[501]: with pidfile: /var/run/squeezelite-armv6hf.pid
Jan 10 03:00:28 2-Blueberry-Keuken squeezelite[501]: Wait until player is connected to Squeezebox server before sending play command
Jan 10 03:00:28 2-Blueberry-Keuken squeezelite[501]: Not connected after 1 seconds...
Jan 10 03:00:29 2-Blueberry-Keuken squeezelite[501]: Player connected to Squeezebox server after 2 seconds
Jan 10 03:00:29 2-Blueberry-Keuken squeezelite[501]: Sending power on command for player 2-Blueberry-Keuken (b8:27:aa:78:aa:8a) to Squeezebox server (192.168.10.99 9090)
Jan 10 03:00:29 2-Blueberry-Keuken systemd[1]: Started Squeezelite LMS player.
My "starting" line shows all the options, yours only shows the name option.

Could it be that user "pi" cannot access the squeelite_settings.sh file?


Greetings,
Gerrelt.
my Raspberry Pi page: http://raspberry.gerrelt.nl

Nakamura13
Posts: 8
Joined: Fri Jan 08, 2016 11:27 am

Re: [Tutorial] Squeezelite up and running on Raspbian

Sun Jan 10, 2016 1:30 pm

Hi Gerrelt,

thank your for your reply.

I have worked around the pulseaudio user rights issue by creating a unix socket.
Got the info from this site:

http://billauer.co.il/blog/2014/01/pa-multiple-users/

Originally it was supposed to be via a TCP socket but the unix socket explained in the comments did the trick for me.
So I managed to get sound output with aplay either with sudo or without.

So far so good.

Now I have a different situation.

When boot the system with squeezelite in standard settings squeezelite is shown in LMS and can play but sound doesn't appear in pavucontrol. When I restart the squeezelite service in shell with

Code: Select all

sudo systemctl restart squeezelite
It all of sudden appears in pavucontrol an is shown as playing source. Sound perfectly comes out of my BT-Speaker.
It kind of feels like pulseaudio is not ready when squeezlite starts its deamon when booting and doesnt connect. When restarting the service manually it finds pulseaudio and connects.

I tried deleting the .pid which did nothing.

I tried running as user Pi by changing the squeezelite_settings.sh which works now. I think I forgot the

Code: Select all

sudo chmod a+x /usr/local/bin/squeezelite_settings.sh
.

after reinstalling your files from the tutorial. But this really doesn't bring any difference to solution.

When I try to set the output device by using

Code: Select all

SL_SOUNDCARD="pulse"
or

Code: Select all

SL_ADDITIONAL_OPTIONS="-o pulse"
I get this status after reboot:

Code: Select all

 squeezelite.service - Squeezelite LMS player
   Loaded: loaded (/etc/systemd/system/squeezelite.service; enabled)
   Active: active (running) since So 2016-01-10 14:24:06 CET; 5s ago
  Process: 1162 ExecStop=/etc/init.d/squeezelite stop (code=exited, status=0/SUCCESS)
  Process: 1211 ExecStart=/etc/init.d/squeezelite start (code=exited, status=0/SUCCESS)
 Main PID: 1258 (squeezelite-arm)
   CGroup: /system.slice/squeezelite.service
           ├─1258 /usr/bin/squeezelite-armv6hf -n Framboos -m b8 27 eb 45 c9 75 -o pulse
           ├─1269 /usr/bin/pulseaudio --start --log-target=syslog
           └─1275 /usr/lib/pulseaudio/pulse/gconf-helper
But now pulseaudio seems crashed since I get "Connection to PulseAudio failed. Automatic retry in 5s" in pavucontrol which stays like this forever. And I get no sound at all.

Hmmpf...

Nakamura13
Posts: 8
Joined: Fri Jan 08, 2016 11:27 am

Re: [Tutorial] Squeezelite up and running on Raspbian

Sun Jan 10, 2016 1:50 pm

Ok, seems like the issue with crashes is an issue with running squeezelite as user pi.

So i changed it back to run as root and output device pulse. Systemctl after startup shows:

Code: Select all

squeezelite.service - Squeezelite LMS player
   Loaded: loaded (/etc/systemd/system/squeezelite.service; enabled)
   Active: inactive (dead) since So 2016-01-10 14:37:54 CET; 1min 11s ago
  Process: 606 ExecStop=/etc/init.d/squeezelite stop (code=exited, status=0/SUCCESS)
  Process: 513 ExecStart=/etc/init.d/squeezelite start (code=exited, status=0/SUCCESS)
 Main PID: 596 (code=exited, status=0/SUCCESS)

Jan 10 14:37:53 raspberrypi sudo[546]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/squeezelite-armv6hf -t
Jan 10 14:37:53 raspberrypi sudo[546]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jan 10 14:37:53 raspberrypi sudo[546]: pam_unix(sudo:session): session closed for user root
Jan 10 14:37:54 raspberrypi squeezelite[513]: Starting: /usr/bin/squeezelite-armv6hf  -o pulse -n Zentrale
Jan 10 14:37:54 raspberrypi squeezelite[513]: with pidfile: /var/run/squeezelite-armv6hf.pid
Jan 10 14:37:54 raspberrypi systemd[1]: Started Squeezelite LMS player.
Jan 10 14:37:54 raspberrypi sudo[626]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/squeezelite-armv6hf -t
Jan 10 14:37:54 raspberrypi sudo[626]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jan 10 14:37:54 raspberrypi sudo[626]: pam_unix(sudo:session): session closed for user root

after sudo systemctl restart squeezelite I get this status:

Code: Select all

squeezelite.service - Squeezelite LMS player
   Loaded: loaded (/etc/systemd/system/squeezelite.service; enabled)
   Active: active (running) since So 2016-01-10 14:40:21 CET; 2s ago
  Process: 606 ExecStop=/etc/init.d/squeezelite stop (code=exited, status=0/SUCCESS)
  Process: 1021 ExecStart=/etc/init.d/squeezelite start (code=exited, status=0/SUCCESS)
 Main PID: 1067 (squeezelite-arm)
   CGroup: /system.slice/squeezelite.service
           └─1067 /usr/bin/squeezelite-armv6hf -o pulse -n Zentrale -m b8 27 eb 45 c9 75

Jan 10 14:40:21 raspberrypi sudo[1041]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/squeezelite-armv6hf -t
Jan 10 14:40:21 raspberrypi sudo[1041]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jan 10 14:40:21 raspberrypi sudo[1041]: pam_unix(sudo:session): session closed for user root
Jan 10 14:40:21 raspberrypi squeezelite[1021]: Starting: /usr/bin/squeezelite-armv6hf  -o pulse -n Zentrale -m b8:27:eb:45:c9:75
Jan 10 14:40:21 raspberrypi squeezelite[1021]: with pidfile: /var/run/squeezelite-armv6hf.pid
Jan 10 14:40:21 raspberrypi systemd[1]: Started Squeezelite LMS player.
Pavucontrol works again but no output from squeezelite is shown.

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

Re: [Tutorial] Squeezelite up and running on Raspbian

Sun Jan 10, 2016 3:29 pm

Try this, open the squeezelite_settings.sh file, and search for this line:

Code: Select all

#SL_MAC_ADDRESS="00:00:00:00:00:01"
And change it to:

Code: Select all

SL_MAC_ADDRESS="b8:27:eb:45:c9:75"
So, uncomment it, and set your mac-address.

Save, and reboot.

Greetings,
Gerrelt.
my Raspberry Pi page: http://raspberry.gerrelt.nl

Nakamura13
Posts: 8
Joined: Fri Jan 08, 2016 11:27 am

Re: [Tutorial] Squeezelite up and running on Raspbian

Tue Jan 12, 2016 12:17 am

Hi Gerrelt,

I really apreciate you help. But it didnt work out. After crashing my pulseaudio completely while trying to run it in system mode I now have build the hole setting on a fresh installation of jessie.

But same issue. Besides that my workaround with pulseaudio doesnt work anymore. God knows why.

I have the same situation now. I can run squeezelite as user pi now. But I get this status now and still no sound via bluetooth:

Code: Select all

squeezelite.service - Squeezelite LMS player
   Loaded: loaded (/etc/systemd/system/squeezelite.service; enabled)
   Active: active (running) since Di 2016-01-12 01:09:45 CET; 1s ago
  Process: 1340 ExecStop=/etc/init.d/squeezelite stop (code=exited, status=0/SUCCESS)
  Process: 1388 ExecStart=/etc/init.d/squeezelite start (code=exited, status=0/SUCCESS)
 Main PID: 1435 (squeezelite-arm)
   CGroup: /system.slice/squeezelite.service
           ├─1435 /usr/bin/squeezelite-armv6hf -n Framboos -m b8 27 eb 45 c9 75
           ├─1446 /usr/bin/pulseaudio --start --log-target=syslog
           └─1449 /usr/lib/pulseaudio/pulse/gconf-helper

Jan 12 01:09:45 RaspZentrale sudo[1409]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/squeezelite-armv6hf -t
Jan 12 01:09:45 RaspZentrale sudo[1409]: pam_unix(sudo:session): session opened for user root by (uid=0)
Jan 12 01:09:45 RaspZentrale sudo[1409]: pam_unix(sudo:session): session closed for user root
Jan 12 01:09:45 RaspZentrale squeezelite[1388]: Starting: /usr/bin/squeezelite-armv6hf  -n Framboos -m b8:27:eb:45:c9:75
Jan 12 01:09:45 RaspZentrale squeezelite[1388]: with pidfile: /var/run/squeezelite-armv6hf.pid
Jan 12 01:09:45 RaspZentrale systemd[1]: Started Squeezelite LMS player.
Jan 12 01:09:45 RaspZentrale pulseaudio[1446]: [pulseaudio] server-lookup.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
Jan 12 01:09:45 RaspZentrale pulseaudio[1446]: [pulseaudio] main.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NotSupported: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
Jan 12 01:09:45 RaspZentrale pulseaudio[1446]: [pulseaudio] bluez4-util.c: org.bluez.Manager.GetProperties() failed: org.freedesktop.DBus.Error.UnknownMethod: Method "GetProperties" with signature "" on interface "org.bluez.Manager" doesn't exist
Which seems to me like an issue with pulseaudio. Because i had something similiar when trying to get bluetooth connection to work on another system.

I really cant believe its so hard to bring sound out of an BT-Speaker. I really can't believe it lol. But I can't sleep peacefully till its solved.

So good night, I'm going to try to sleep now.

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

Re: [Tutorial] Squeezelite up and running on Raspbian

Tue Jan 12, 2016 7:42 pm

Well, sleep tight! :)

This is something to think about in the morning then:

I find it strange that your output does not contain a "-o <soundcard>" in the startup command line.
This is yours:

Code: Select all

Jan 12 01:09:45 RaspZentrale squeezelite[1388]: Starting: /usr/bin/squeezelite-armv6hf  -n Framboos -m b8:27:eb:45:c9:75
And this is mine:

Code: Select all

Jan 10 03:00:28 2-Blueberry-Keuken squeezelite[501]: Starting: /usr/bin/squeezelite-armv6hf  -o equal -n 2-Blueberry-Keuken -m b8:27:aa:78:aa:8a -s 192.168.10.99
Note the "-o equal". I am using an equalizer, so I don't have the soundcard name there, but only "equal".
There should be "-o pulse" in yours, I think.
my Raspberry Pi page: http://raspberry.gerrelt.nl

Nakamura13
Posts: 8
Joined: Fri Jan 08, 2016 11:27 am

Sun Jan 17, 2016 3:46 pm

Hi Gerrelt,

thanks for your support. I'm totally stuck. I let it rest for a week and tried again today. The "-o pulse" was deactivated. Since it didn't make any difference wether I called pulse directly or let it happen over default audio card.

I still have the same issues.

When starting squeezelite as user pi, I still get the d-bus and bluez errors, which seems like an issue with pulseaudio itself.

When startign squeezelite as root I still can't maneuver my sound to pulseaudio since its in user session mode and not systemwide mode. However I couldn't manage to get it to run in system mode either.

Its really devastating and my girlfriend hates me already for spending days and hours in the office to crack this nut. ;-)

Nakamura13
Posts: 8
Joined: Fri Jan 08, 2016 11:27 am

Re: [Tutorial] Squeezelite up and running on Raspbian

Sun Jan 17, 2016 6:25 pm

good news. I finally got the workaround running again.

I can play sound over Pulsaudio with root redirected over a unix socket again.

Last problem is squeezelite connects to "bcm2835 ALSA" and plays over it while blocking it for pulseaudio.

When I do

Code: Select all

sudo systemctl restart squeezelite


bcm2835 ALSA is set free and appaers as output device in pavucontrol. When I start a stream from LMS it perfectly runs over BT-speaker.

Question: Is there

a) a way to tell squeezelite to wait for pulseaudio or Xserver GUI before starting

b) a way to restart squeezelite service in Xserver-Autostart, which would be a not so elegant version i guess

??

Thanks in advance

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

Re: [Tutorial] Squeezelite up and running on Raspbian

Mon Jan 18, 2016 8:04 pm

Hi Nakamura13,

Try one of these three options.

1. change the "after" setting of the systemd config script.
Open the script:

Code: Select all

sudo nano /etc/systemd/system/squeezelite.service
And change "After=network.target" to this:

Code: Select all

After=graphical.target
Then save and exit, and reload the daemons:

Code: Select all

sudo systemctl daemon-reload
And do a reboot.

2. Switch to "cron" to startup squeezelite at boot.
First disable the systemd daemon:

Code: Select all

sudo systemctl disable squeezelite.service
sudo systemctl daemon-reload
And then add it to cron, open crontab:

Code: Select all

sudo crontab -e
And add this line to the end of the file:

Code: Select all

@reboot /etc/init.d/squeezelite start
Save and exit the file.

Variations on this "solution". Instead of calling the squeezelite script, start squeezelite directly, using aprox, this line:

Code: Select all

@reboot /usr/bin/squeezelite-armv6hf -z -n Framboos -m b8:27:eb:45:c9:75
Note: I added the "-z" to start it as a daemon.

Another thing to consider, "sudo crontab -e" opens a different crontab then "crontab -e". The first one starts everything as root, the other one as user pi (I think).

3. Add a sleep to the startup script.
This is quite a quick and dirty method.
Open the squeezelite script:

Code: Select all

sudo nano /etc/init.d/squeezelite
and find these lines:

Code: Select all

#
# Function that starts the daemon/service
#
do_start()
{
Add this line after them:

Code: Select all

sleep 5
This will make the script sleep for 5 seconds before moving on, and starting squeezelite...

Good luck... and say "sorry" to your girlfriend for me... ;)

Greetings,
Gerrelt.
my Raspberry Pi page: http://raspberry.gerrelt.nl

Nakamura13
Posts: 8
Joined: Fri Jan 08, 2016 11:27 am

Re: [Tutorial] Squeezelite up and running on Raspbian

Wed Jan 20, 2016 4:05 pm

HEUREKAAAAAAAAAAAA

Hi Gerrelt,

unfurtunatly neither of these 3 options or any permutation didn't do the trick.

BUT since i was already experimenting with autostarts in LXDE your quick and dirty solution with "sleep" gave the last spark to it.

So here the final solution

first deactivate the service:

Code: Select all

sudo systemctl disable squeezelite
then write a script to execute with LXDE-startup in my case auto.sh with root rights:

Code: Select all

sudo nano auto.sh
here the script:

Code: Select all

#!/bin/sh -e

sudo systemctl start squeezelite
make it executable with root rights:

Code: Select all

sudo chmod +x auto.sh
Since my first aproaches to run the script in

Code: Select all

~/.config/lxsession/LXDE-pi/autostart
didn't work i tried a different aproach but I'm pretty sure it would work as well now. However I tried it with a desktop file since I had the feeling those desktop-files are executed in a later stage of LXDE startup. Pls correct me if I'm wrong.

so go to:

Code: Select all

/etc/xdg/autostart 
Create a file with extension .desktop in my case MeinStart.desktop:

Code: Select all

sudo nano MeinStart.desktop

Code: Select all

[Desktop Entry]
Type=Application
Name=MeinStart
Exec=/home/pi/LXDE_Auto/auto.sh
All this didn't do the trick alone. The final and crucial switch in the end was:

Code: Select all

#
# Function that starts the daemon/service
#
do_start()
{
sleep 5
Now everything works like it should. Besides my Alsa output over HDMI is kinda stuttering and sometimes disappears. When I change volume settings in pavucontrol it reapears suddenly. Very strange behaviour.

Any ideas about that one?

The moment I turn on the BT-Speaker pulseaudio automatically switches to BT and sound runs perfectly.
Which was the main goal.

So thank you very much Gerrelt. And my girlfriend send greetings back. She laughed so hard when I told her.

jrubins
Posts: 30
Joined: Thu Apr 09, 2015 8:17 pm

Re: [Tutorial] Squeezelite up and running on Raspbian

Fri Mar 04, 2016 4:04 pm

Hi there,
I'm looking to set up a Pi2 music player. Does Squeezelite run on the Raspberry Pi 2? All the download/install instructions have 'armv6' which is the Pi 1's processor. Also, does Squeezelite read the music files directly from the Pi's storage or do I need to install a server? I've seen LMS server mentioned in Gerrelt's tutorial. Where does one get the LMS server from, or do I have to have an actual Logitech device that runs that server? If it's just software, can it run on the same Pi as Squeezelite?

Thanks,
James

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

Re: [Tutorial] Squeezelite up and running on Raspbian

Fri Mar 04, 2016 9:17 pm

Hi James,
jrubins wrote: I'm looking to set up a Pi2 music player. Does Squeezelite run on the Raspberry Pi 2?
Yes, it runs on a Raspberry Pi 2. In fact one of my Pi's is a Pi 2, and I am using it as a squeezelite player.
jrubins wrote: Also, does Squeezelite read the music files directly from the Pi's storage or do I need to install a server?
It doesn't read music files directly from the Pi's storage, you need to install a LMS server.
jrubins wrote: Where does one get the LMS server from, or do I have to have an actual Logitech device that runs that server? If it's just software, can it run on the same Pi as Squeezelite?
No, you don't need a Logitech device, and: Yes, you can run the LMS server on your Pi, see this part of my other tutorial:
http://www.gerrelt.nl/RaspberryPi/wordp ... box_server
It also describes how to get the software.
NOTE: the tutorial is written for a standalone "without-connection-to-your-local-wifi-network" situation. But it can easily be used as instructions on how to install the LMS server on a Pi that is connected to your local network. Skip the part which describe how to setup a WiFi access point, and instead of using 192.168.42.1 as the IP address, use the IP address that is assigned to the Raspberry that is running the LMS server.

Another option would be to run the LMS server on your NAS (if you have one) or on a windows PC (I don't know about Apple). Instructions for that can probably be found somewhere on the internet.

Greetings,
Gerrelt.
my Raspberry Pi page: http://raspberry.gerrelt.nl

jrubins
Posts: 30
Joined: Thu Apr 09, 2015 8:17 pm

Re: [Tutorial] Squeezelite up and running on Raspbian

Sun Mar 06, 2016 12:28 am

Gerrelt wrote:
It doesn't read music files directly from the Pi's storage, you need to install a LMS server.
jrubins wrote: Where does one get the LMS server from, or do I have to have an actual Logitech device that runs that server? If it's just software, can it run on the same Pi as Squeezelite?
No, you don't need a Logitech device, and: Yes, you can run the LMS server on your Pi, see this part of my other tutorial:
http://www.gerrelt.nl/RaspberryPi/wordp ... box_server
It also describes how to get the software.
NOTE: the tutorial is written for a standalone "without-connection-to-your-local-wifi-network" situation. But it can easily be used as instructions on how to install the LMS server on a Pi that is connected to your local network. Skip the part which describe how to setup a WiFi access point, and instead of using 192.168.42.1 as the IP address, use the IP address that is assigned to the Raspberry that is running the LMS server.

Another option would be to run the LMS server on your NAS (if you have one) or on a windows PC (I don't know about Apple). Instructions for that can probably be found somewhere on the internet.

Greetings,
Gerrelt.
Gerrelt, thanks for the great tutorials!
I have been able to get everything installed and working well, except ...
The output from the audio isn't running through my custom alsa conf. (~/.asoundrc)
When I run the command

Code: Select all

/usr/bin/squeezelite-armv6hf  -n rubymusic -m 00:c1:41:17:09:31 -s 127.0.0.1
by itself the audio *does* run through the custom alsa setup. The setup name is called 'default' so all audio should run through it unless otherwise specified. From what I can tell using

Code: Select all

sudo /etc/init.d/squeezelite status
is calling the same command

Code: Select all

sudo /etc/init.d/squeezelite status
● squeezelite.service - Squeezelite LMS player
   Loaded: loaded (/etc/systemd/system/squeezelite.service; enabled)
   Active: active (running) since Sat 2016-03-05 16:20:46 PST; 2s ago
  Process: 2625 ExecStop=/etc/init.d/squeezelite stop (code=exited, status=0/SUCCESS)
  Process: 2971 ExecStart=/etc/init.d/squeezelite start (code=exited, status=0/SUCCESS)
 Main PID: 3009 (squeezelite-arm)
   CGroup: /system.slice/squeezelite.service
           └─3009 /usr/bin/squeezelite-armv6hf -n rubymusic -m 00 c1 41 17 09 31 -s 127.0.0.1

Mar 05 16:20:45 rubymusic sudo[2983]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/squeezelite-armv6hf -t
Mar 05 16:20:45 rubymusic sudo[2983]: pam_unix(sudo:session): session opened for user root by (uid=0)
Mar 05 16:20:45 rubymusic sudo[2983]: pam_unix(sudo:session): session closed for user root
Mar 05 16:20:45 rubymusic squeezelite[2971]: Starting: /usr/bin/squeezelite-armv6hf  -n rubymusic -m 00:c1:41:17:09:31 -s 127.0.0.1
Mar 05 16:20:45 rubymusic squeezelite[2971]: with pidfile: /var/run/squeezelite-armv6hf.pid
Mar 05 16:20:45 rubymusic squeezelite[2971]: Wait until player is connected to Squeezebox server before sending play command
Mar 05 16:20:45 rubymusic squeezelite[2971]: Not connected after 1 seconds...
Mar 05 16:20:46 rubymusic squeezelite[2971]: Player connected to Squeezebox server after 2 seconds
Mar 05 16:20:46 rubymusic squeezelite[2971]: Sending power on command for player rubymusic (00:c1:41:17:09:31) to Squeezebox server (127.0.0.1 9090)
Mar 05 16:20:46 rubymusic systemd[1]: Started Squeezelite LMS player.
Any idea what's happening in the script call that isn't happening when i make the manual command?

Thanks,
James

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

Re: [Tutorial] Squeezelite up and running on Raspbian

Sun Mar 06, 2016 3:14 pm

Hi James,

I think this is your problem:
The user under which the process is started is different in the two cases.
Your manual startup is started with user "pi", the automatic startup is started under user "root" ( I think).

The .asoundrc file is only used with user "pi". If you want to make it usable for user root, then you should use a asound.conf file.

See the equalizer tutorial for an asound.conf example:
http://www.gerrelt.nl/RaspberryPi/wordpress/equalizer/

Disclaimer: I'm not very knowledgable with the alsa config files. I made the equalizer work through trial and error... :)

Greetings,
Gerrelt.
my Raspberry Pi page: http://raspberry.gerrelt.nl

jrubins
Posts: 30
Joined: Thu Apr 09, 2015 8:17 pm

Re: [Tutorial] Squeezelite up and running on Raspbian

Mon Mar 07, 2016 1:57 am

Gerrelt wrote:Hi James,

I think this is your problem:
The user under which the process is started is different in the two cases.
Your manual startup is started with user "pi", the automatic startup is started under user "root" ( I think).

The .asoundrc file is only used with user "pi". If you want to make it usable for user root, then you should use a asound.conf file.

See the equalizer tutorial for an asound.conf example:
http://www.gerrelt.nl/RaspberryPi/wordpress/equalizer/

Disclaimer: I'm not very knowledgable with the alsa config files. I made the equalizer work through trial and error... :)

Greetings,
Gerrelt.
Gerrelt, your advice was correct, running as user=pi and everything works!
Well, almost everything...
high resolution audio files have over/underruns very badly, the audio has become quite choppy.
This doesn't happen if I play the same song in ecasound

Code: Select all

ecasound -i /media/usbstick/music/The\ Four\ Seasons/01\ Concerto\ pour\ deux\ violons\ et\ violoncelle\ RV\ 578a\ -\ Adagio\ e\ spiccato.flac -f:24,2,96000  -z:nodb -b:80
running -status

Code: Select all

● squeezelite.service - Squeezelite LMS player
   Loaded: loaded (/etc/systemd/system/squeezelite.service; enabled)
   Active: active (running) since Sun 2016-03-06 17:42:58 PST; 4min 30s ago
  Process: 1548 ExecStop=/etc/init.d/squeezelite stop (code=exited, status=0/SUCCESS)
  Process: 1985 ExecStart=/etc/init.d/squeezelite start (code=exited, status=0/SUCCESS)
 Main PID: 2023 (squeezelite-arm)
   CGroup: /system.slice/squeezelite.service
           └─2023 /usr/bin/squeezelite-armv6hf -n rubymusic -m 00 c1 41 17 09 31 -s 127.0.0.1 -a 80

Mar 06 17:42:57 rubymusic sudo[1997]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/squeezelite-armv6hf -t
Mar 06 17:42:57 rubymusic sudo[1997]: pam_unix(sudo:session): session opened for user root by (uid=0)
Mar 06 17:42:57 rubymusic sudo[1997]: pam_unix(sudo:session): session closed for user root
Mar 06 17:42:57 rubymusic squeezelite[1985]: Starting: /usr/bin/squeezelite-armv6hf  -n rubymusic -m 00:c1:41:17:09:31 -s 127.0.0.1 -a 80
Mar 06 17:42:57 rubymusic squeezelite[1985]: with pidfile: /var/run/squeezelite-armv6hf.pid
Mar 06 17:42:57 rubymusic squeezelite[1985]: Wait until player is connected to Squeezebox server before sending play command
Mar 06 17:42:57 rubymusic squeezelite[1985]: Not connected after 1 seconds...
Mar 06 17:42:58 rubymusic squeezelite[1985]: Player connected to Squeezebox server after 2 seconds
Mar 06 17:42:58 rubymusic squeezelite[1985]: Sending power on command for player rubymusic (00:c1:41:17:09:31) to Squeezebox server (127.0.0.1 9090)
Mar 06 17:42:58 rubymusic systemd[1]: Started Squeezelite LMS player.
Could this possibly be a user issue also? I see the session is opened for root and closed for root. Does squeezelite attempt to downsample the audio? That's my other hypothesis.

Thanks,
James

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

Re: [Tutorial] Squeezelite up and running on Raspbian

Tue Mar 08, 2016 6:34 pm

I think the "-a 80" setting is false. It looks like my settings file is based on older version of the squeezelite options list.
This is the latest help file for squeezelite:

Code: Select all

Squeezelite v1.8-658, Copyright 2012-2015 Adrian Smith. See -t for license terms
Usage: /usr/bin/squeezelite-armv6hf [options]
  -s <server>[:<port>]  Connect to specified server, otherwise uses autodiscovery to find server
  -o <output device>    Specify output device, default "default", - = output to stdout
  -l                    List output devices
  -a <b>:<p>:<f>:<m>    Specify ALSA params to open output device, b = buffer time in ms or size in bytes, p = period count or size in bytes, f sample format (16|24|24_3|32), m = use mmap (0|1)
  -a <f>                Specify sample format (16|24|32) of output file when using -o - to output samples to stdout (interleaved little endian only)
  -b <stream>:<output>  Specify internal Stream and Output buffer sizes in Kbytes
  -c <codec1>,<codec2>  Restrict codecs to those specified, otherwise load all available codecs; known codecs: flac,pcm,mp3,ogg,aac,dsd (mad,mpg for specific mp3 codec)
  -C <timeout>          Close output device when idle after timeout seconds, default is to keep it open while player is 'on'
  -d <log>=<level>      Set logging level, logs: all|slimproto|stream|decode|output|ir, level: info|debug|sdebug
  -e <codec1>,<codec2>  Explicitly exclude native support of one or more codecs; known codecs: flac,pcm,mp3,ogg,aac,dsd (mad,mpg for specific mp3 codec)
  -f <logfile>          Write debug to logfile
  -i [<filename>]       Enable lirc remote control support (lirc config file ~/.lircrc used if filename not specified)
  -m <mac addr>         Set mac address, format: ab:cd:ef:12:34:56
  -M <modelname>        Set the squeezelite player model name sent to the server (default: SqueezeLite)
  -n <name>             Set the player name
  -N <filename>         Store player name in filename to allow server defined name changes to be shared between servers (not supported with -n)
  -p <priority>         Set real time priority of output thread (1-99)
  -P <filename>         Store the process id (PID) in filename
  -r <rates>[:<delay>]  Sample rates supported, allows output to be off when squeezelite is started; rates = <maxrate>|<minrate>-<maxrate>|<rate1>,<rate2>,<rate3>; delay = optional delay switching rates in ms
  -R -u [params]        Resample, params = <recipe>:<flags>:<attenuation>:<precision>:<passband_end>:<stopband_start>:<phase_response>,
                         recipe = (v|h|m|l|q)(L|I|M)(s) [E|X], E = exception - resample only if native rate not supported, X = async - resample to max rate for device, otherwise to max sync rate
                         flags = num in hex,
                         attenuation = attenuation in dB to apply (default is -1db if not explicitly set),
                         precision = number of bits precision (NB. HQ = 20. VHQ = 28),
                         passband_end = number in percent (0dB pt. bandwidth to preserve. nyquist = 100%),
                         stopband_start = number in percent (Aliasing/imaging control. > passband_end),
                         phase_response = 0-100 (0 = minimum / 50 = linear / 100 = maximum)
  -D [delay]            Output device supports DSD over PCM (DoP), delay = optional delay switching between PCM and DoP in ms
  -v                    Visualiser support
  -L                    List volume controls for output device
  -U <control>          Unmute ALSA control and set to full volume (not supported with -V)
  -V <control>          Use ALSA control for volume adjustment, otherwise use software volume adjustment
  -z                    Daemonize
  -t                    License terms
  -?                    Display this help text
See the two -a options, you are using the second one, but 80 is not a valid value.
Try setting it to: 80:::1

Open the settings file:

Code: Select all

sudo nano /usr/local/bin/squeezelite_settings.sh
And change the #SL_ALSA_PARAMS line to:

Code: Select all

SL_ALSA_PARAMS="80:::1"
(you may want to play around with the 80 value)

Let me know if this works, then I will change the default value in the settings file.

Greetings,
Gerrelt.
my Raspberry Pi page: http://raspberry.gerrelt.nl

jrubins
Posts: 30
Joined: Thu Apr 09, 2015 8:17 pm

Re: [Tutorial] Squeezelite up and running on Raspbian

Thu Mar 10, 2016 12:03 am

Thanks Gerrelt,
I did a bit more reading on the format of the ALSA options call and ended up using

Code: Select all

-a 80:4:24:0
Which is a period of 80:4 periods: 24 bit sample rate: 0 mmap (whatever that is)
This works well for me.

Thanks,
James

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

Re: [Tutorial] Squeezelite up and running on Raspbian

Thu Mar 17, 2016 6:32 pm

Thanks for the feedback, James!

I've now set the default value to "80:::0" in the squeezelite_settings.sh script.

Greetings,
Gerrelt.
my Raspberry Pi page: http://raspberry.gerrelt.nl

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

Re: [Tutorial] Squeezelite up and running on Raspbian Wheezy

Sat Apr 16, 2016 5:24 pm

Michielo wrote: Just a small remark on the RPI squeezelite tutorial website you made (which is great by the way).
Spotify has been running on my RPI and feeding 3 RPI Squeezelite players for several months without any issues and remote controlling using Ipeng IOS app. However, you need to be mindful of

(1) changing the helper app port when using RaspBMC. My standard port had a conflict with one of the ports used by XBMC.
(2) No support for offline listening.
(3) No support for playing Spotify playlists. You can create your own local playlists with Spotify music, but you cannot use those created by others and hosted on Spotify (at least I have not found a way to do this).
Hi Michielo,

Your post was from 2014, and in the meantime things have changed. There is now a Spotify Protocol Handler plugin, that is based on Triode's Spotify plugin. This Protocol Handler supplements the standard LMS Spotify plugin.
This setup supports playing the standard Spotify Playlists, the same as in the android Spotify app.

I've written a short tutorial on how to setup Spotify on the LMS server:

How to setup Spotify with the Squeezebox server

You might want to consider switching to the Protocol Handler.

Greetings,
Gerrelt.
my Raspberry Pi page: http://raspberry.gerrelt.nl

doppiej
Posts: 11
Joined: Wed Jul 18, 2012 2:58 pm

Re: [Tutorial] Squeezelite up and running on Raspbian

Wed Jun 01, 2016 7:08 pm

Hello,

I am trying to follow the tutorial to install squeezelite next to my Domoticz installation on my raspi 2.
I have this really cheap usb soundcard: http://img.dxcdn.com/productimages/sku_21812_3.jpg
After doing

Code: Select all

sudo alsamixer
I press F6 to select sound card and chose "1 USB PnP Sound Device". Is this the right one to choose?
Then when I list all the devices with

Code: Select all

sudo /usr/bin/squeezelite-armv6hf -l
I get a list with the USB PnP Sound Devices and not the C-Media as you have and mine is listed as C-Media as well when I do lsusb.
Then when I do

Code: Select all

sudo /usr/bin/squeezelite-armv6hf -o front:CARD=Set,DEV=0 -s 192.168.2.4
I changed it to front:CARD=Device,DEV=0 as it is listed like that and changed the ip. However I am receiving these errors:
[21:06:40.875764] test_open:320 playback open error: No such device
[21:06:40.876808] output_init_common:382 unable to open output device

Can you help me? Thanks!

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

Re: [Tutorial] Squeezelite up and running on Raspbian

Thu Jun 02, 2016 5:11 pm

Hi doppiej,

Could you run the check-script and post/message/mail the results back at me?
You can find the check-script here:
http://www.gerrelt.nl/RaspberryPi/wordp ... /#Problems

Greetings,
Gerrelt.
my Raspberry Pi page: http://raspberry.gerrelt.nl

doppiej
Posts: 11
Joined: Wed Jul 18, 2012 2:58 pm

Re: [Tutorial] Squeezelite up and running on Raspbian

Thu Jun 02, 2016 8:35 pm

This is what it returned:

============================== Report v1.0 Start ==============================
--------------- Linux version: ---------------
Linux Raspi-TV 4.1.18-v7+ #846 SMP Thu Feb 25 14:22:53 GMT 2016 armv7l GNU/Linux
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
--------------- Hostname: ---------------
Raspi-TV
127.0.1.1 Raspi-TV
--------------- Squeezelite: ---------------
-rwxr-xr-x 1 pi pi 1113600 May 6 15:23 /usr/bin/squeezelite-armv6hf
--------------- Squeezelite daemon script: ---------------
ls: cannot access /etc/init.d/*squee*: No such file or directory
--------------- Squeezelite init.d daemon settings: ---------------
ls: cannot access /etc/rc*.d/*squeeze*: No such file or directory
--------------- Squeezelite systemd status: ---------------
● squeezelite.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
--------------- List sound devices: ---------------
Output devices:
null - Discard all samples (playback) or generate zero samples (capture)
default:CARD=ALSA - bcm2835 ALSA, bcm2835 ALSA - Default Audio Device
sysdefault:CARD=ALSA - bcm2835 ALSA, bcm2835 ALSA - Default Audio Device
dmix:CARD=ALSA,DEV=0 - bcm2835 ALSA, bcm2835 ALSA - Direct sample mixing device
dmix:CARD=ALSA,DEV=1 - bcm2835 ALSA, bcm2835 IEC958/HDMI - Direct sample mixing device
dsnoop:CARD=ALSA,DEV=0 - bcm2835 ALSA, bcm2835 ALSA - Direct sample snooping device
dsnoop:CARD=ALSA,DEV=1 - bcm2835 ALSA, bcm2835 IEC958/HDMI - Direct sample snooping device
hw:CARD=ALSA,DEV=0 - bcm2835 ALSA, bcm2835 ALSA - Direct hardware device without any conversions
hw:CARD=ALSA,DEV=1 - bcm2835 ALSA, bcm2835 IEC958/HDMI - Direct hardware device without any conversions
plughw:CARD=ALSA,DEV=0 - bcm2835 ALSA, bcm2835 ALSA - Hardware device with all software conversions
plughw:CARD=ALSA,DEV=1 - bcm2835 ALSA, bcm2835 IEC958/HDMI - Hardware device with all software conversions
default:CARD=Device - USB PnP Sound Device, USB Audio - Default Audio Device
sysdefault:CARD=Device - USB PnP Sound Device, USB Audio - Default Audio Device
front:CARD=Device,DEV=0 - USB PnP Sound Device, USB Audio - Front speakers
surround21:CARD=Device,DEV=0 - USB PnP Sound Device, USB Audio - 2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Device,DEV=0 - USB PnP Sound Device, USB Audio - 4.0 Surround output to Front and Rear speakers
surround41:CARD=Device,DEV=0 - USB PnP Sound Device, USB Audio - 4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Device,DEV=0 - USB PnP Sound Device, USB Audio - 5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Device,DEV=0 - USB PnP Sound Device, USB Audio - 5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Device,DEV=0 - USB PnP Sound Device, USB Audio - 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Device,DEV=0 - USB PnP Sound Device, USB Audio - IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=Device,DEV=0 - USB PnP Sound Device, USB Audio - Direct sample mixing device
dsnoop:CARD=Device,DEV=0 - USB PnP Sound Device, USB Audio - Direct sample snooping device
hw:CARD=Device,DEV=0 - USB PnP Sound Device, USB Audio - Direct hardware device without any conversions
plughw:CARD=Device,DEV=0 - USB PnP Sound Device, USB Audio - Hardware device with all software conversions

--------------- Squeezelite daemon script settings: ---------------
--------------- Squeezelite running? : ---------------
--------------- Restart-at-night job? : ---------------
============================== Report End ==============================

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

Re: [Tutorial] Squeezelite up and running on Raspbian

Thu Jun 02, 2016 9:02 pm

Hmm...strange, I think your command to start squeezelite should have worked.

Maybe try it as default soundcard, like this:

Code: Select all

sudo /usr/bin/squeezelite-armv6hf -o default:CARD=Device -s 192.168.2.4
my Raspberry Pi page: http://raspberry.gerrelt.nl

doppiej
Posts: 11
Joined: Wed Jul 18, 2012 2:58 pm

Re: [Tutorial] Squeezelite up and running on Raspbian

Fri Jun 03, 2016 3:17 pm

Thanks for helping me out! Only the default soundcard is working, but it works so thanks :)

Return to “Graphics, sound and multimedia”