PDA

View Full Version : A pragmatic way how to stream new music services (Apple Music, Amazon Music, ...)



johndoe_2009
2016-03-19, 00:50
Hi,

I have been wondering throughout the last 12 months how I could best use Apple Music, Amazon Prime Music, Napster and other new music services that might appear in the market with my Squeezebox devices.

Of course, the ideal way would be to have all of those fully integrated into the Squeezebox Server and the respective user interfaces on each player type (Duett, Boom, Radio, ...), on LMS web interface, on iPeng, etc.

After following this community and other 3rd party plugin creators, I decided for myself that this will never happen, because of many multiple and complex reasons (API avaiability on the music service side, stability and decent documentation of those APIs, programming and maintenance/continous bug fixing of the new plugin on LMS side that would be needed, just to mention a few).

Then, I told myself that most of those new fancy music services would probably always have an iOS app that can handle Apple's Airplay as one of the very first features. Those iOS apps would also be the "benchmark" when it comes to availability of service specific features (e.g. currently there is a neat Spotify plugin for LMS, which I am very thankful about - but it does not offer all of the Spotify specific features one can use on their iOS app).

After this decision, I looked into Shairport and waveinput plugin, to get the chain: iOS device > Airplay > Shairport > waveinput plugin > Squeezebox Server/LMS setup and running.

Unfortunately, I found that Shairport did not work stable in my environment (constantly disappearing as Airplay receiver, issues with my LMS server waking up after sleeping, drops during playback, long delay up to 15 seconds during playback, ...

Then, after doing some more research a comment of a user in this forum gave me the idea: just go to the original hardware and set up the whole chain

iOS device > Airplay > Shairport > waveinput plugin > Squeezebox Server/LMS

with as much original hardware and software as possible. I ended up with the following:

iOS device (iPhone or iPad) with e.g. Apple Music or Amazon Music > Airplay > Apple TV 3rd gen (wired to network switch) > SPDIF optical out > optical in on my LMS Windows based server > waveinput plugin > Squeezebox Server/LMS

After some tweaking in the beginning I now find that this setup works dramatically more stable then Shairport. The sound quality is probably not for audiophiles, but I do not hear much of a difference when comparing to the native stream from my LMS. I find the audio quality is actually very good.

Yes, I needed to invest into hardware:
- Apple TV 3rd Gen (bought it on ebay for EUR 45 including shipping)
- USB soundcard for my Windows LMS server with optical input/SPDIF input (i bought a model "CSL - USB 7.1 Soundkarte extern (8-Kanal)" on the German Amazon site for EUR 27). Windows installed microsoft drivers for this device, they work well until now

and yes, the setup does consume more electrical power:
- Apple TV is constantly running, but it also goes into standby and can be woken up when selected as Airplay target. Internet research suggested that the Apple TV does rarely consume more then 1 Watt
- the addtional USB soundcard, which is always running on my LMS Windows server. I expect that this thing does not consume more then 2 Watt - but I did not measure myself. I have turned off all other devices in Windows settings on this soundcard and only have the SPDIF input active
Overall, I am expecting a constant power consumption of not more then 3 Watts, which is not a lot at all - at least IMHO

But for the stability, usability, Woman acceptance factor in the household and my own peace of mind, it was a worthwile investment.

I tweaked waveinput a little bit (http://wiki.slimdevices.com/index.php/WaveInput_plugin):
- in file WAVIN.pm i have changed the buffer with the command "sub bufferThreshold { 70 }"
- in file custom-convert.conf i have set a smaller buffer "[wavin2cmd] -m 8192 -n 2 -o $FILE$" in the "wavin pcm * *" section

With this tweaking, I get a delay from my iOS App to music play on a squeezebox device of about 4 seconds. 3 out of those 4 seconds are preset on the radio input section of the LMS (see in LMS settings > extended > network > buffer size for radio; minimum is here 3 seconds). Waveinput behaves like a radio station in LMS (at least this is what I have understood).

With this small delay, I am very happy.

I hope that this setup will help other Squeezebox users to close the gap of compatibility between Squeezebox and newer streaming devices such as Sonos.

johndoe_2009
2016-03-29, 13:12
Update: after some testing, I found that if there are no adjustments to WAVIN.pm and custom-convert.conf there is a delay of about 5 seconds. As I had some rebuffering-issues, I turned of the the buffer tweaking and switched on flac conversion, as I am hoping that will consume less wifi bandwidth for the more remote Squeezebox players.

The flac on-the-fly-conversion you set the following way:
- In Squeezebox web interface, go to settings > extended > file types
- in the section for Wave Input, deactivate MP3 and PCM, and set FLAC to wavin2cmd/flac

bpa
2016-03-29, 13:20
3 out of those 4 seconds are preset on the radio input section of the LMS (see in LMS settings > extended > network > buffer size for radio; minimum is here 3 seconds). Waveinput behaves like a radio station in LMS (at least this is what I have understood).

Your use of "sub bufferThreshold { 70 }" is overiding this radio buffer setting - any smaller and you'll probably get rebuffering as there is no leeway for network delays. I think some of the delay comes from Windows as wavin2cmd uses a v. old WIndows Audio API. Delay was a lot smaller on older Windows (e.g. XP).

rawaho
2016-11-25, 05:57
Hi,
I've been pretty close to simply apply your approach. In the end, I didn't need to by using a plugin and want to share the process so anyone is able to do so. At least with comparable environments, this should work.
Environment:

Server: Intel NUC, Core i3, 4 GB RAM, Windows 10 Pro x64, connected via LAN
Logitech Media Server (LMS): 7.7.6 - 1479375548
OS: Windows 10
Players: SB Touch, SB Radio, both connected via LAN



I did the following:

Started with this post: http://forums.slimdevices.com/showthread.php?106289-announce-ShairTunes2W-Airtunes-on-LMS-(forked-version-with-Windows-support)&p=865036&viewfull=1#post865036
Updated Logitech Media Server (LMS) to 7.7.6: http://downloads.slimdevices.com/nightly/?ver=7.7
Restart
Opened Logitech Media Server (LMS), Settings, Plugins, scroll to the bottom: Additional Repositories. Post the URL http://downloads.sourceforge.net/project/lms-plugins-philippe44/repo-sf.xml and click OK on the lower right corner. Install Plugin
LMS restart
Opened Logitech Media Server (LMS), Settings, Plugins, make sure the "ShairTunes2 (fork) (v0.35.3)" is selected
Windows Control Panel\Windows Firewall\, Advance Settings, Add a new incoming rule: Allow the program %ALLUSERSPROFILE%\Squeezebox\Cache\InstalledPlugin s\Plugins\ShairTunes2W\Bin\shairport_helper-win.exe
Checked with iTunes on the Notebook connected via WLAN, that worked right away: iTunes connects via Airplay (top bar, the button between volume and currently playing title) just fine and plays.
iPhone 5s and 6 seemed to not even see the Players, but that was my fault: To see airplay *audio* devices on iOS 10.x, you have to swipe the popup screen to the left. On iOS 10.x, the airplay devices you see on the default popup screen are the video devices
Finally, adjust the playback volume on phone, Squeezebox and Amplifier and it worked.


For me, both devices are on a pretty fast WLAN connetion and the sound is very good now. Whether you need a quick WLAN I don't know, but at least with it and decent amps/speakers the result is fine.
You can run devices simultaneously, so having both players in use by two iPhones playing different songs works perfectly, even with Cover-Image, Title etc., I guess you can run both on the same source as well.

Take the time and try it. The best of luck for you,
rawaho

P.S.: In case you don't see the players at all, try to disable the Firewall completely for a test. Then you'll get at least an impression whether it's the firewall, but keep in mind to enable it again.