Closed Saiyato closed 7 years ago
The timeout for file handles is no longer needed, a new stream will be added instead.
SoX investigation is still needed, documentation is not clear enough to implement.
I have been breaking my head on this for some time now. I have no idea how to have SoX output to a specified pipe.
Just to give you my thoughts on this. When looking at spop.conf It does look as if it is using ALSA as output. With the selected output from volumio.
Now for me as a user it would make more Sense to select snapcast output in volumio to enable multiroom output. Now it is my understanding you can create a fifo output in ALSA. If you could make this selecteble From within volumio as default output all the other music services would use this output. I believe someone was doing this with Bluetooth output. https://volumio.org/forum/how-add-more-alsa-sinks-cards-json-t6427.html
Anyway, hope I made myself Clear in this steenkolen english. Goodluck Dennis
Hi, I just put this into my /etc/spopd.conf file:
[sox]
output_type = raw output_name = /tmp/snapfifo
Just tested, and it works. Not thoroughly tested, though.
OK, to correct myself a bit - the playback is quite fast. Might need to tweak some formats to get it right.
man soxformat has a good list for output formats
EDIT: After a bit more research, it seems spop is using sample rate 44100 and not 48000, as was default for snapserver/snapclient. This is hardcoded in spop/src/spotify.c:
static unsigned int g_audio_rate = 44100;
For now, I just changed the sample rate in Volumio, both for volumio and snapserver/snapclient to 44100. This is not configurable in the sox options in spop.
Forget my last comment. After some testing, I ended up with this:
[sox] output_type = raw output_name = /tmp/snapfifo effects = rate 48k
Oh wow, thanks for investigating! This is highly appreciated, will try to implement it this week. I had come across the raw output, just didn't have the time to test it, this saves me alot of time.
I'll just have to figure out a way to fix the timing problem when using combined playlists. For example:
Switching between Spotify and MPD will take some time, I've experienced this with using one fifo for Spotify-Connect and MPD. So I either need to mix the streams or make plugs, in which case I can still use the ALSA output type.
But I will test this first, thanks again.
Just did an initial test and it works indeed. The fifo output will accept new streams instantaneously, so no need to reloop the sound. This makes the patch a lot easier.
I will work on a patch for the template, so that saving (with new credentials) will not undo the change.
Great. I have experienced some occasional hiccups when playing from different sources. One time I had an internet radio stream playing and then tried to switch to a spotify song, but both kept playing simultaneously to the fifo. Couldn't reproduce it now, though, but it might be a problem.
The simultaneous playback problem is likely a problem in Spotify, as opposed to snapcast. I'm not sure how long Spotify in the current form is supported, we might need to look for a new solution soon.
I've implemented an update of the config template for the native Spotify plugin.
NOTE: You need to (re)save your credentials (that way the new template is used) for the changes to take effect.
Bummer, I see I forgot to add the effects options, will repatch tonight!
Great work :-)
Kristian, can you retest maybe? You will need to reinstall the Spotify plugin and update the index.js in the snapcast plugin.
I have added the effects option, I never had deformed playback, so I thought maybe you could test this? :)
I just uploaded a new version
Thanks, I'll test it :)
I can't really get the /etc/spopd.conf file to get patched. How exactly do I do this? Do I need to install the plugins in a set order? Just reinstalled both snapcast plugin and spotify plugin. Saved my credentials in the spotify plugin, then went to the snapcast plugin configuration, set up everything as I wanted, and clicked save an all corresponding buttons.
Hi Kristian,
Since the snapcast plugin is unaware of any previous installations and I don't want it to patch things automatically, the order in which you should best configure is:
a. Any of the plugins balbuze made b. A standalone Librespot library (you need to either source this or compile it yourself; with pipe backend!) c. The spop (native Volumio 2) variant
You can also set the sampling rate here, I couldn't get the channels option to work though with spop, just like bit depth. So I've omitted the channels option.
The bit rate you've set in this section (Spotify integration settings) will be used as of now (the version of last night used the server settings (default = 48kHz); this was wrong).
So in short:
I. Choose your implementation II. Set all quality parameters applicable for your implementation III. Save
Also I've re-opened the issue so anyone else can read along. I'll close it when we've confirmed it works.
Thanks. Had to reboot volumio to eventually get it to patch correctly.
Multiple effects should be possible, but you have to add a semicolon between options, e.g.:
effects = rate 48000; channels 2
Things work correctly for me now, except for one thing - I always get
output_name = /tmp/spotfifo
even if I disabled "Dedicated stream for spotify".
Yes, I have to patch this, I only change the template once (I expect ${outdev}), but I think I can "sed" this correctly.
Just uploaded a new version, I added the channels. Couldn't get the bit depth working though, not sure if it really changes anything. Anyways, channels should work and you should be able to repatch spop-config.
Changing the Spotify settings will automatically patch the spop.conf and template file, you still need to restart the daemon.
Great work! I think you can close this now, if I'm having any other issues, I can just open a new issue :)
Awesome, thanks for pointing me in the right direction, this has helped a lot in development.
Create volumio native spotify settings.
[x] Find out what is needed to pipe output [x] Patch settings files -> sox [x] Fix timeout needed to switch output (file handles?) <- not needed!