Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


[HOW-TO] Spotify Connect Web for Moode
My system has Rpi3B, Hifiberry Dac+ and a Mini HA-DSP. Using Rafa's GIT HUB page was able to connect to my Pi3B / Hifiberry DAC+ and play music using Spotify Android app. However, when I switch from I2S audio device to usb audio device (HA-DSP device) and play the same song with Spotify there is no sound. I can say MoOde doesn't mind as I am able to switch from device to device must be Spotify connect build needs to modified or corrected. 

Could changing the hw parameter in asound.conf from 0 to 1 be a possible solution? Is my use of two DAC's on one Pi  not recommended?
Reply
Yes, exactly. You configure which hardware sound card you will be controlling with the software volume. If you are going to be switching back and forth, that could be an issue.

You could try running two different services of spotify connect, one with each output (and change names accordingly), but this is not an easy task and I am swarmed up at work to provide useful instructions for such an approach right now, sorry!
Reply
(08-09-2018, 05:24 AM)RafaPolit Wrote: Yes, exactly.  You configure which hardware sound card you will be controlling with the software volume.  If you are going to be switching back and forth, that could be an issue.

You could try running two different services of spotify connect, one with each output (and change names accordingly), but this is not an easy task and I am swarmed up at work to provide useful instructions for such an approach right now, sorry!


Thanks Rafa - Thought I was on the right track. As I am not a DEV will just set it up to work on the primary MiniDsp HA_DSP device.
Reply
I cannot get the connection to work, my Device never shows up in the Spotify-App

After some experimenting I noticed that the spotify-connect-web.service always shuts down after a few seconds and restarts. 
And after some more experimenting I was able to get this error message (it's some weird trial and error, because this message does not appear as soon as the service starts and disappears as soon as it reastarts

Code:
Aug 27 12:19:13 moode systemd[1]: Started spotify-connect-web.service.
pi@moode:~ $ sudo systemctl status spotify-connect-web.service
● spotify-connect-web.service
  Loaded: loaded (/lib/systemd/system/spotify-connect-web.service; enabled; vendor preset: enabled)
  Active: active (running) since Mon 2018-08-27 12:19:13 CEST; 7s ago
Main PID: 953 (spotify-connect)
  CGroup: /system.slice/spotify-connect-web.service
          ├─953 /bin/sh /home/pi/spotify/spotify-connect.sh
          └─954 python main.py --playback_device softvol -m Master --mixer_device_index 1 --bitrate 320 --name moOde Connect --key /home/pi/spotify/spotify-connect-web/spotify_appkey.key

Aug 27 12:19:21 moode spotify-connect.sh[953]: Loading Spotify library...
Aug 27 12:19:21 moode spotify-connect.sh[953]: Last.fm: incomplete credentials, not launched
Aug 27 12:19:21 moode spotify-connect.sh[953]: Traceback (most recent call last):
Aug 27 12:19:21 moode spotify-connect.sh[953]:   File "main.py", line 15, in <module>
Aug 27 12:19:21 moode spotify-connect.sh[953]:     from connect import Connect
Aug 27 12:19:21 moode spotify-connect.sh[953]:   File "/home/pi/spotify/spotify-connect-web/connect.py", line 9, in <module>
Aug 27 12:19:21 moode spotify-connect.sh[953]:     from console_callbacks import audio_arg_parser, mixer, error_callback, connection_callbacks, debug_callbacks, playback_callbacks, playback_setup
Aug 27 12:19:21 moode spotify-connect.sh[953]:   File "/home/pi/spotify/spotify-connect-web/console_callbacks.py", line 105, in <module>
Aug 27 12:19:21 moode spotify-connect.sh[953]:     mixer = alsa.Mixer(args.mixer, **mixer_card_arg)
Aug 27 12:19:21 moode spotify-connect.sh[953]: alsaaudio.ALSAAudioError: No such file or directory [hw:1]

The last line specifically makes no sense to me, because my device in the asound.conf is not named hw:1

My asound.cond looks like this (pink noise is working just fine like this)
Code:
pcm.softvol {
 type softvol
 slave {
   pcm "hw:sndrpihifiberry"
 }
 control {
   name "Master"
   card 0
 }
}

Also, it does not matter, if the mixer_device_index is 0 or 1
Any suggestions?
Reply
Ok, you could try a couple of things:
1. Try changing the control name from "Master" to something else, sometimes Master is reserved. This would involve changing both the asound.conf and the spotify-connect.sh
2. Try changing in control card to 1 instead of 0.

We should get a better troubleshooting. The other option is to enter the 'alsamixer' command in the ssh terminal and ensure that the Master (or whichever name ends up working) is actually created in the right Card.

Honestly, with all the possible con combinations and everything that can go wrong here, I feel a bit overwhelmed and perhaps it's not a good idea to offer this code at all until there are more robust integrations. Sorry for all the failed attempts.

Best regards,
Rafa.
Reply
Rafa,

You have done well and many have benefited so don't doubt your instincts. Thank you

I struggled with getting to work but to be honest it was the result of my own shortcomings. Instructions were clearly written and once I focused and took thinks step it ended well. Two adjustments I needed to make:   pcm "hw:0" and  change gevent.wsgi to gevent.pywsgi in main.py. The first change I figured out on my own but the second I never would have figured out. Shout out to Platheo. I would like to know what the diff is between wsgi and pywsgi. Well that will be my homework assignment. 

All the best

Tim
Reply
Thanks for the Ideas Rafa and please don't be so hard on yourself. You're doing a great job getting this to work at all.

I'm afraid what you suggested did not work. Changing the control name did not improve anything, but it didn't make it worse after all.
Changing the control card produces as error when trying the pink noise test, so this is not working at all I'm afraid.
Reply
Photo 
Hi Rafa,

I'm running Moode 4.2 and running the spotify-web-connect fine for playing music. I'm now working on the UI. I believe I have deployed the flow through the Node-red editor and seems to be working:

 [Image: ToNgWXv.png]

The Spotify Status blinks in 1 second interval.

However, I don't see the moode GUI updating, both in my 7" touch screen and also in web ui from my desk. Below is my footer.php

[Image: el5Ds6X.png]

Can you help me diagnose the issue?

Thanks!
Reply
Wow, that is a brave attempt! LOL!

Ok, this is probably not going to work. The one thing is to make sure that you have created the spotifylib.js file inside the js directory?

Version 4.2 has an updated UI and that script is based on CSS selectors that worked for 4.0, maybe 4.1, but most likely things have changed. There would probably need to be a new script coded for the new UI version.

I have yet to install v4.2, I was hoping to do that with a DigiOne I bought, but it's been a month and I haven't yet received the package.

I'll try and see if things have changed much as soon as I install v4.2.

Glad to know at least the Playback of spotify is working! Best regards,
Rafa.
Reply
You could try moving the script include just above the closing body tag, as the script takes control of the knob element which has not yet been included before the php ifs.

So, put the two lines in the footer right above the </body> line.

Depending on other configs, it may also work better inside the first 'if' block, where the knob is inserted, at the end of those scripts within the if block
Reply


Forum Jump: