Spotify Connect

Discuss, contribute and orient Volumio development!

Ads helps Volumio remain Free and Open Source. Please consider donating to help us continue to serve you.

Spotify Connect

Postby tomcek » Wed Feb 10 2016 14:09

Here we go ...


aplay -l
Code: Select all
**** List of PLAYBACK Hardware Devices ****
card 0: sndrpihifiberry [snd_rpi_hifiberry_dac], device 0: HifiBerry DAC HiFi pcm5102a-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 1: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0


aplay -L
Code: Select all
null
    Discard all samples (playback) or generate zero samples (capture)
default:CARD=sndrpihifiberry
    snd_rpi_hifiberry_dac,
    Default Audio Device
sysdefault:CARD=sndrpihifiberry
    snd_rpi_hifiberry_dac,
    Default Audio Device
dmix:CARD=sndrpihifiberry,DEV=0
    snd_rpi_hifiberry_dac,
    Direct sample mixing device
dsnoop:CARD=sndrpihifiberry,DEV=0
    snd_rpi_hifiberry_dac,
    Direct sample snooping device
hw:CARD=sndrpihifiberry,DEV=0
    snd_rpi_hifiberry_dac,
    Direct hardware device without any conversions
plughw:CARD=sndrpihifiberry,DEV=0
    snd_rpi_hifiberry_dac,
    Hardware device with all software conversions
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
User avatar
tomcek
Audiophile
Audiophile
 
Posts: 116
Joined: Wed Feb 19 2014 15:06

Ads helps Volumio remain Free and Open Source. Please consider donating to help us continue to serve you.


Spotify Connect

Postby tomcek » Wed Feb 10 2016 15:57



Reading the issue I tried to comment out the use of mixer:

in connect.py:
Code: Select all
#mixer_volume = int(mixer.getvolume()[0] * 655.35)
#lib.SpPlaybackUpdateVolume(mixer_volume)


in console_callbacks.py:
Code: Select all
#mixer = alsa.Mixer(args.mixer)


Without success :(
User avatar
tomcek
Audiophile
Audiophile
 
Posts: 116
Joined: Wed Feb 19 2014 15:06


Spotify Connect

Postby arjenr » Thu Feb 11 2016 15:18

I don't know exactly what's going wrong.

Like in the issue, did you execute the command: amixer ?
If yes, and you get no results. Try this guideline: https://www.hifiberry.com/guides/mixer-settings/

Did you already test with the command line if the Hifiberry gives any sound?
Random avatar
arjenr
Fresh off the boat
Fresh off the boat
 
Posts: 9
Joined: Tue Jan 19 2016 09:15


Spotify Connect

Postby tomcek » Thu Feb 11 2016 22:32

arjenr wrote:Like in the issue, did you execute the command: amixer ?
If yes, and you get no results. Try this guideline: https://www.hifiberry.com/guides/mixer-settings/

The alsa-utils are already installed and using each of the commands brings me always the following message:

amixer: Unable to find simple control ...

Starting "alsamixer" shows me the message "This sound device does not have any controls."


Did you already test with the command line if the Hifiberry gives any sound?

No, I didn´t. How can I do that?

The DAC itself works. I use it with volumio very well (stream music via Airplay).
User avatar
tomcek
Audiophile
Audiophile
 
Posts: 116
Joined: Wed Feb 19 2014 15:06


Spotify Connect

Postby bikeman » Fri Feb 12 2016 01:06

I resolved my issue with the
SpInit: 0
Traceback (most recent call last):
File "main.py", line 27, in <module>
connect_app = Connect(web_error_callback)
File "/usr/src/app/connect.py", line 75, in __init__
lib.SpPlaybackUpdateVolume(mixer_volume)
OverflowError: can't convert negative number to unsigned

error message by reverting back to the 3.18.5-v7+ kernel after having updated it. After that spotify connect is now starting and working fine.

The only issue I am now having is that since then the volume control in volumio does not work. I can control the volume from spotify when using connect but when playing things through the volumio web interface the volume control does nothing.

I presume it is that connect is not releasing the mixer control when it is not playing a track but I am unsure how to resolve this.

I am running a HiFiBerry DAC+ Pro on a RPi2 btw.
Random avatar
bikeman
Fresh off the boat
Fresh off the boat
 
Posts: 2
Joined: Wed Feb 03 2016 21:04


Spotify Connect

Postby mankowskiwik » Sat Feb 13 2016 09:39

Hello Everybody,

Thank you very much for all information provided in this thread.
I got Spotify Connect running without a problem, including autostart.

Is there a possible way of resampling audio from it? In volumio I have it set to 32/192, but via spotify connect it goes directly to 44. I like upsampling and would like to stick to that option. Thank you in advance for help.

As off topic, I might have a small advise if someone would like to install chroot directly in our user home folder, instead of root.

1. Follow first two steps of instllation, starting in our home directory i.e. /home/pi:

Code: Select all
curl -O http://spotify-connect-web.s3-website.eu-central-1.amazonaws.com/spotify-connect-web.sh
chmod u+x spotify-connect-web.sh


2. Run:
Code: Select all
sudo nano /home/pi/spotify-connect-web.sh


3.Change DIR to desired one, example fo "pi" user:

Code: Select all
DIR=/home/pi/spotify-connect-web-chroot


CTRL + X and Y and enter for Save and Quit

4. Now install:
Code: Select all
/home/pi/spotify-connect-web.sh install

(change "pi" to your username if neccessary)

Code: Select all
sudo cp spotify_appkey.key  /home/pi/spotify-connect-web-chroot/usr/src/app/


5. And simply run
Code: Select all
./spotify-connect-web.sh --username 12345678 --password xyz123 --bitrate 320



There might be a different way to install, however this is what I have been struggling with and it might be the case for other users. I saw posts of people copying from root to home directory (this is what I did for the first time, as I could now make it autorun after restart).
Random avatar
mankowskiwik
Fresh off the boat
Fresh off the boat
 
Posts: 6
Joined: Sat Feb 13 2016 09:22


Spotify Connect

Postby twirre » Sat Feb 13 2016 20:07

I also had problems with the --mixer switch. I performed the install as written in the readme on github. I think the --mixer problems occur on the analog hifiberryDAC. I use it with an RPi B. My fix is to comment all code using the mixer and volume. And I got it working.

connect.py
Code: Select all

#from console_callbacks import audio_arg_parser, mixer, error_callback, connection_callbacks, debug_callbacks, playback_callbacks, playback_setup
from console_callbacks import audio_arg_parser, error_callback, connection_callbacks, debug_callbacks, playback_callbacks, playback_setup

#        mixer_volume = 1 #int(mixer.getvolume()[0] * 655.35)
#        lib.SpPlaybackUpdateVolume(mixer_volume)



console_callbacks.py
Code: Select all
#audio_arg_parser.add_argument('--mixer', '-m', help='alsa mixer name for volume control', default=alsa.mixers()[0])

#mixer = alsa.Mixer(args.mixer)

#@ffi.callback('void(uint16_t volume, void *userdata)')
#@userdata_wrapper
#def playback_volume(self, volume):
#    print "playback_volume: {}".format(volume)
#    mixer.setvolume(int(volume / 655.35))

playback_callbacks = ffi.new('SpPlaybackCallbacks *', [
    playback_notify,
    playback_data,
    playback_seek#,
    #playback_volume



I'm still not 100% sure if there isn't an more elegant way. So that is still under investigation. It should be possible to pass an working playback_volume if the mixer is not available.

But for now the result is a working spotify:connect and with that i'm pleased. Tomorrow I will put the whole config to a more thorough test.
Last edited by twirre on Tue Feb 16 2016 15:36, edited 2 times in total.
User avatar
twirre
Fresh off the boat
Fresh off the boat
 
Posts: 7
Joined: Sun Feb 02 2014 20:51


Spotify Connect

Postby tomcek » Sat Feb 13 2016 20:27

Hi twirre,

I tried it as well but without luck.

Can you tell me what happens if you start "amixer" or "alsamixer" from console? Is "alsamixer" telling you "This sound device does not have any controls."?
User avatar
tomcek
Audiophile
Audiophile
 
Posts: 116
Joined: Wed Feb 19 2014 15:06


Spotify Connect

Postby twirre » Sat Feb 13 2016 20:43

amixer gives no response. It is installed
Code: Select all
root@volumio:~# amixer -v
amixer version 1.0.27.2
root@volumio:~# amixer
root@volumio:~#


alsamixer gives a gui. I installed in my search for the solution.

I am under the imperession that the problem is the DAC itself. I t doesnt support volume_controle. For example i had (and have) no problems playing spotify playlists through the volumio gui. If it really is an mixer problem, this also shouldnt be working (for a far a i understand it).
Attachments
alsamixer.png
screenshot_alsamixer
alsamixer.png (57.87 KiB) Viewed 1270 times
User avatar
twirre
Fresh off the boat
Fresh off the boat
 
Posts: 7
Joined: Sun Feb 02 2014 20:51


Spotify Connect

Postby twirre » Sat Feb 13 2016 21:04

what is the message you get, when starting
Code: Select all
 ./spotify-connect-web.sh --user abc --password 123 --name rpiVolumio --bitrate 320
User avatar
twirre
Fresh off the boat
Fresh off the boat
 
Posts: 7
Joined: Sun Feb 02 2014 20:51

PreviousNext

Return to Development talks

Who is online

Users browsing this forum: No registered users and 0 guests