Spotify Connect on RuneAudio

Raspberry Pi related support

Re: Spotify Connect on RuneAudio

Postby dynobot » 14 May 2019, 22:13

spotityd.conf

[global]
username = "blahblah" <-----your account name
password = "blahblahblah" <----your account pw
device = "default:CARD=DSD" <------hw:....can not be used
volume-control = "softvol"
device_name = "Bedroom" <----text only what ever name you want
bitrate = 320

Also even though you seem to be getting sound 'without' enabling the kernel for I2S it still should be enabled to get the intended function of a I2S card. Note: all HATS function in I2S mode to communicate vs USB.

Also when you started the service, since its running as root, you can't include the --user in the systemctl line, per instructions.

systemctl start spotifyd.service
systemctl enable spotifyd.service
User avatar
dynobot
 
Posts: 81
Joined: 19 May 2014, 15:04
Location: GA-USA

Re: Spotify Connect on RuneAudio

Postby Ema_82 » 14 May 2019, 23:24

dynobot wrote:spotityd.conf

[global]
username = "blahblah" <-----your account name
password = "blahblahblah" <----your account pw
device = "default:CARD=DSD" <------hw:....can not be used
volume-control = "softvol"
device_name = "Bedroom" <----text only what ever name you want
bitrate = 320

Also even though you seem to be getting sound 'without' enabling the kernel for I2S it still should be enabled to get the intended function of a I2S card. Note: all HATS function in I2S mode to communicate vs USB.

Also when you started the service, since its running as root, you can't include the --user in the systemctl line, per instructions.

systemctl start spotifyd.service
systemctl enable spotifyd.service


Obviously I used my username and password in the first two fields.
I fixed the device with "card 1" (as in indicate in aplay -l) and I see from the log that is detected correctly.

I enabled also the I2S kernel in the config.txt.

And yes, I know that I can't include the --user in the systemctl line.

After these changes I reboot runeaudio and started spotifyd: still the same error.
Then I stopped spotifyd and launched the command systemctl status spotifyd

Here's the log info:

Code: Select all
May 15 00:06:28 runeaudio spotifyd[895]: 00:06:28 [INFO] Using software volume controller.
May 15 00:06:28 runeaudio spotifyd[895]: 00:06:28 [ERROR] Caught panic with message: called `Result::unwrap()` on an `Err` value: Os { code: 98, kind: AddrInUse, message: "Address already in use" }
May 15 00:06:28 runeaudio systemd[1]: spotifyd.service: Main process exited, code=exited, status=101/n/a
May 15 00:06:28 runeaudio systemd[1]: spotifyd.service: Unit entered failed state.
May 15 00:06:28 runeaudio systemd[1]: spotifyd.service: Failed with result 'exit-code'.
May 15 00:06:30 runeaudio systemd[1]: Stopped A spotify playing daemon.
Ema_82
 
Posts: 11
Joined: 13 May 2019, 09:01

Re: Spotify Connect on RuneAudio

Postby dynobot » 14 May 2019, 23:32

aplay -l -and- aplay -L gives two different results. Spotifyd uses the output from aplay -L

Therefore the line should read something like default:CARD=something, as supposed to hw or card which is the output of aplay -l

Good luck
User avatar
dynobot
 
Posts: 81
Joined: 19 May 2014, 15:04
Location: GA-USA

Re: Spotify Connect on RuneAudio

Postby Ema_82 » 14 May 2019, 23:44

aplay -L shows the correct card with the following name: sysdefault:CARD=sndrpihifiberry

I copypasted the line in spotityd.conf and checked that is correctly detected.
No way, after the reboot I still get the same error :cry:
Ema_82
 
Posts: 11
Joined: 13 May 2019, 09:01

Re: Spotify Connect on RuneAudio

Postby tml3nr » 15 May 2019, 15:43

For me this spotityd.conf work fine on Rune 0.4, Boss Dac:

Code: Select all
[global]
username = xxx
password = xxx
backend = alsa
device = hw:0 # Given by `aplay -L`
mixer = Digital
volume-control = alsa # or alsa_linear, or softvol
#onevent = command_run_on_playback_event
device_name = RuneAudio
bitrate = 320
#cache_path = /tmp/spotifyd
volume-normalisation = false
#normalisation-pregain = -10
tml3nr
 
Posts: 51
Joined: 02 Apr 2016, 07:43

Re: Spotify Connect on RuneAudio

Postby Ema_82 » 15 May 2019, 16:15

I've already used that configuration without success.
I'm pretty convinced that the problem does not depend on the configuration file and I suspect (from what I've read around on similar problems, although not strictly related to runeaudio and spotifyd) that is something related to the listening port that spotifyd uses to connect to.
I'm quite ignorant on the subject, but from what I read, it could be that the service tries to connect to a port that is occupied by another running service. And if this is true, I now need to understand how to see if there are other active processes and how to possibly stop them.
Is it possible? What do you think?
Thanks
Ema_82
 
Posts: 11
Joined: 13 May 2019, 09:01

Re: Spotify Connect on RuneAudio

Postby Ema_82 » 15 May 2019, 21:06

Solved! Finally! ... With a rather drastic but effective remedy: I killed all the active processes with
Code: Select all
 killall -u root
and restarted the Raspberry. Once relaunched spotifyd, it started correctly!

Thanks to janui, dynobot and tml3nr for trying to help me and excuse me for flooding the topic :P
Ema_82
 
Posts: 11
Joined: 13 May 2019, 09:01

Re: Spotify Connect on RuneAudio

Postby tml3nr » Yesterday, 06:12

Use onevent parameter to enhance the sound quality for spotifyd. Automatically start and stop mpd (and other service etc) when play and stop Spotify Connect.

Code: Select all
root@runeaudio(rw):~# spotifyd --help
Usage: spotifyd [options]

Options:
  -c, --config CONFIG Path to a config file.
  -u, --username USERNAME
  Spotify user name.
  -p, --password PASSWORD
  Spotify password.
  --device DEVICE Audio device, given by aplay -L.
  --mixer DEVICE  Audio mixer
  --bitrate DEVICE
  Any of 96, 160, and 320.
  --pid PID-FILE  Path to PID file.
  --device_name DEVICE
  Name of this Spotify device.
  --backend BACKEND
  Audio backend.
  --cache_path PATH
  Path to cache location.
  --volume-normalisation
  Apply volume normalisation per track.
  --normalisation-pregain PREGAIN
  dB of pregain for volume normalisation
  --onevent COMMAND
  Run a command on events. Environment variables
  PLAYER_EVENT, TRACK_ID,OLD_TRACK_ID are passed to the
  command.
  --volume-control CONTROLLER
  Possible values are alsa, alsa_linear, and softvol.
  -v, --verbose  Add debug information to log.
  --no-daemon  Don't detach from console.
  --backends  List available audio backends.
  -h, --help  Print this help text.


Create spotifyd_even.sh. Set chmod 755:

nano /home/root/spotifyd_event.sh

#!/bin/bash

case "$PLAYER_EVENT" in

start)
# Stop mpd
systemctl stop mpd
exit
;;

stop)
# Start mpd
systemctl start mpd
exit
;;
esac
exit 0


Edit spotifyd.service:

Code: Select all
ExecStart=/usr/bin/spotifyd --no-daemon --onevent /home/root/spotifyd_event.sh


Done!!!

PS: We may need to restart the related scripts to re-set the service settings.
tml3nr
 
Posts: 51
Joined: 02 Apr 2016, 07:43

support RuneAudio Donate with PayPal

Previous

Return to Raspberry Pi

Who is online

Users browsing this forum: makfredo and 1 guest