the server


Let's start with a bold opening statement: 

The LogitechMediaServer (LMS) happens to be the best music streaming server 
software out there.

I'm pretty confident you'll be able to answer your very valid "Why is that!?!?" 
question yourself later on.
The LMS is - as its name suggests - the server part of a very powerful, 
feature-packed and rock solid client-server audio streaming environment.
Despite its Logitech company reference - suggesting the obvious - you actually don't need 
a single Logitech device in the system. And no, you don't even have to sign up with 
any Logitech web service.

LMS requires a computer and a compatible streaming client, such as the excellent and 
widely spread squeezelite streaming client application (opensource under GPL). 
Both, server and client are running on pretty much all operating systems out there.





With this article I'd like to share some hopefully useful background information 
and setup advise that should get you going on the Streaming-Server part.




Intro


Just to emphasize at the very beginning: The entire home audio streaming approach - running 
your very own audio server - only makes sense if you own and plan to maintain your own audio data collection. 

If that's not the case, you better save your time reading this article. 
Running e.g. the Qobuz, Spotfiy, Tidal, or whatever audio streaming app on your phone, while beaming (HD-) audio towards your HD-bluetooth capable DAC will save you a lot of time, efforts and money. With a quality BT dac at hand the soundquality will be all but a poor compromise.

As usual, there'll be a group of folks (including me) who'll stick to their own digital audio collection 
for a while. To me my own audio collection is a treasure.
  
However. It's not that I havn't tried pretty much all of them and that I wouldn't make use of online-streaming services occasionally. I'm just not willing to sign up a 250 $/€ /year contract, while having more then sufficient thoroughly selected audio data on my SSD.

The server manages the music collection and related images. The server handles the networking, 
the streams, the commands, the back and forth signaling towards the clients. 
The server also talks to your control app on your phone or web-browser. 
It further offers tons of plugins, e.g. a Spotify, Tidal or Qobuz plugin, a DOP/DSD native plugin, a equalizer, resampler, convolution engine asf, asf...

Let's start having a look at the client-server audio streaming architecture.

The server is the central spot of the home audio streaming network, the spider in the web.

To be able to do a satisfactory job a media or data server usually requires 
certain characteristics. A high performance server requires


  • sufficient processing power
  • high performance storage
  • solid network performance
  • low power consumption
  • high reliability


What's actually meant by "satisfactory job"???


I'm not talking about the features, such as Spotify,... asf. I'm talking about 
the HW and underlying operating system performance. To me a server has 
to be 100% transparent to the user. Meaning. While sitting on the couch I 
choose a track push a button and music starts playing - 24/7. 
All that without annoying delays, lags/latency or even stuttering while 
scrolling through your cover arts, selecting tracks or controlling the volume.

I expect 100% transparency and 0% annoyance from a server.

Your chosen HW and OS setup need to match your requirements and 
expectations of course. I've seen many people running a LMS installation on a RPi 3. 
Yes. It will work. But to me, 100% transparency and 0% annoyance simply will 
never ever apply to a RPi 3 based server solution. It simply can't work.

I've been running a Broadwell i5 NUC as server for years. This solution complied pretty
much to all the high-performance characteristics mentioned before. On the power side
the NUC runs a bit high of course. It's expensive. Just a close to perfect server.

There have been developments on my side recently.


RPi4 as audio streaming server


Since end of 2020 I am running a RPi 4 as streaming server. Why is that?

A RPi 4 delivers
  • sufficient processing power (NO demanding DSP work on my side)
  • GBit ethernet performance
  • USB 3.0 and data SSD
  • low power consumption (around 3W)

As with many ARM boards the processing power is the weak spot, and that's still valid for the RPi 4. Keep in mind. The RPi 4 comes with a single PCIE lane that provides 4GBit/s. All USB ports (3 and 2) and the Gbit ethernet is connected to that single lane. That single lane would  
not even cover the 5Gbit USB3 specs alone. But hey. 4Gbit is worlds apart from earlier RPI models.

Since I do not run any demanding (DSP) jobs, the RPi 4 is serving my server duty extremely well.
OK. A database scan takes a little longer. But hey. 3 minutes extra isn't killing me. During the early 
RPi days it could take hours to scan a library.

As soon as the server HW part is settled, to find the right operating system (OS) will be the 
next challenge.

Windows, Linux, OSX ??? Even Microsoft realized that a server needs to run Linux. 
OSX is also a Unix btw. Apple is not known for offering great flexibility. And OSX must be considered 
a niche market. You better avoid both of them.

OK. Let's stick to Linux. LMS is offered as package on Debian and pretty much all other major distros. 
Basically you could simply install a Raspbian OS and the LMS package on top and you'd be set. 
There are tons of HowTos on the net. Many major audio distros also offer LMS - piCorePlayer, DietPi, 
Volumio, Max2Play to name a few - as feature or plugin.


Let's assume you have your server HW and OS chosen.


You'll have several scenarios to go ahead. You can have server and client on one machine 
or you can run them on separate machines.

Keeping the server separate from my experience is a good idea for several reasons.
To list a few:


  • You can keep the server close to the router, especially if you don't have
    ethernet cable wiring in your home.
    Do not use Wifi to attach a server to a network!
  • You keep that server away from the actual audio room and audio system
  • You don't have to sit in the audio room (living room in my case) to do all kind of config and maintenance work
  • Running CPU hungry DSP work, such as resampling or convolution, working with large collections and handling several clients will put high demands on a server.
    You don't want to have all that running on your highly efficient playback client.
  • sharing USB for storage and DAC would not be such a good idea
  • your streaming client can become/remain really slim and highly efficient as discussed in the other articles


That's why I recommend to put the server part on an external server and let the clients 
run as separate highly efficient  streaming clients.




Logitech Media Server - LMS


Some words about the LMS package.



The whole LMS package has not much - as the name would suggest - to do with the company Logitech anymore.

Logitech shut down its audio streaming business quite a long time ago - around 2012.
They still contribute server space and a little manpower (AFAIK) to keep the server project running. 
The community still contributes (maintenance/features/plugins) to the project.

Bottom line. The LMS project is very much alive - in 2020! You won't bet on the wrong horse.

Since it is 100% free, you can't really do wrong.




LMS alternatives


Yes. There are alternative audio networking concepts.

DLNA/UPNP (non commercial)



Many audio streaming device manufacturers are offering so called DLNA/UPNP endpoints.
These endpoints require a DLNA/UPNP server. 2017 the consortium behind the project buried the project. 
That fact alone disqualifies this "alternative". Of course. There is a reason for everything. 
The approach was never really sophisticated! And todays technologies simply made such 
a technology obsolete. Bad luck for those who bought DACs/streamers following this approach.  


Local Playback with network storage


Moode, Volumio, Rune asf. are forked from the very same origin. And the underlying solution is 
based on a Linux application called Music Player Daemon. It's a backdground process.
The OSes simply attached a Web-Server that executes this or that command. Not what I'd
call sophistcated.

This setup is actually a simple playback solution. Not a proper client-server networking solution.

These solutions are all but sophisticated. And the networking (streaming ) part pretty much 
boils down to using a network storage for your local player.

Non of these solutions IMO offer a scope comparable to a LMS based solution.


Commercial streaming solutions


Then there are commercial solutions. The market leader - I'd say - seems to be Roon from Roonlabs.
Roon offers a lot of features. And is very end-customer focused. 
Commercial Audio manufacturers also making use of it.

As with pretty much all commercial solutions, they usually lack certain flexibility. 
You gotta eat what's on the table. You better don't ask for more.


Roon comes at an IMO hefty pricetag ($500 lifetime or 119$ a year!!). I am wondering what 
supposedly justifies that pricetag. At such as pricetag I'd rather sign up with one of the 
music streaming services and buy me a great Bluetooth DAC.


Others


Then you'll find e.g. Max2Play offering partially free and also commercial services. Max2Play
also started to integrate home automation stuff. It's a nice project. Just shave a look.

Then you've got Sonos. That's pretty much proprietary stuff. I'm not really sure how quickly 
you'll find out about the limitations that come with such a solution. Nope. Nothing I would
go for.


And there are more... ...we leave it at that.


Bottom line


Pretty much all solutions can be tried. The commercial solutions usually offer trial periods. 
It's your choice. It'll be not easy to find your way in that jungle.

After looking at many of the solutions out there I concluded there'd be no solution matching 
my requirements, except LMS. 

And folks. I've been part of the Moode team for a while. Moode I consider a real nice piece of work. It's really well done. It just doesn't match my idea of a server base inside an audio  streaming network.




Streaming clients


The vast majority (my guess!) of LMS users out there nowadays are using DIY streaming 
devices (e.g. RPi) with community provided open source software packages. 
You'll find complete OS images you can put on SD cards. These are almost plug'n play. 
A bit of configuration work via web-browser usually needs to be done to get going.

Usually such projects are a lot of fun to build and can be accomplished even without 
in-depth technical knowledge. Again. IMO no need to run after commercial solutions.

From an audio quality and overall performance perspective these projects IMO can compete 
with (audiophile) commercial products - usually at a fragment of cost.

There are also quite some commercial streamers out there, which are piggybacking 
on community built streaming software, such as squeezelite, to get their HW going.
These devices are then sold at breathtaking pricetags.

On Android and iOS you can find commercial streaming client apps, which act as 
squeeze-clients and are able to stream music from an LMS server. I own pretty much 
all of them, but honestly I never use them.

The original Logitech HW streaming clients, such as the Squeezebox Touch, as the last group 
of streaming clients talking to LMS are a dying art - as far as I see it - RIP.

Let's wrap it up.


There are several reasons going for LMS.


1. It's feature packed

Pretty much all audio formats are supported. Even native DSD playback.
It offers all kind of plugins to do DSP work. Pretty much all major Audio Streaming services (except Amazon Music) are supported.


2. It's well maintained

Not any software has any value if it's not maintained and enhanced. There are many examples out there showing how it shouldn't be done.
There's still a great active community behind LMS supporting it. That's key.
The SW exists for more then a decade (1. slimserver -> 2. squeezeboxsrver -> 3. LogitechMediaServer )


3. It's MultiPlatform

LMS runs basically on all major OS platforms - Windows, OSX, Linux. It'll run on PCs
as well as on ARM SBCs such as RPI, on NAS asf.


4. It's fast and stable

Handling collections of 50k albums is not a problem - at least on appropriate HW.


5. It's extremely flexible

There are all kind of plugins available.
It can be used for convolution, converting different file formats, routing different codecs to different devices, even UPNP asf. asf.

And. You are the captain! You can tailor and customize LMS to your own needs in several areas.


6. It's free

You don't have to pay anything and you don't have to pay for stuff you actually do not
need.


However. I do think it's fair to do some small amount donations here and there!
Usually people won't get rich by donations, but at least they can buy some test
equipment, storage etc.

7. Community

Not to forget. There's huge community out there supporting you.



8. Major Downsides

Where there is light...

Documentation. Yes, there are infos on the web, such as the LMS Wiki.
Most of the stuff is incomplete and/or outdated though. 

Luckily the LMS doesn't require that much documentation for a user. There are 
some help menus inside the LMS, there's the community and most of the stuff
is self-explaining. With this article I try to give some more directions.



Installation



1. Platform


I'd recommend a Linux platform. If you run Debian, Ubuntu or Fedora you simply 
need to get the package for your platform and install it.

There are also packages for OSX and Windows and the sources. Just in case.

On some ARM based systems such as piCorePlayer or DietPi you simply have to enable 
the service.



2. Software package


In case you'd like to install the LMS package manually, you need to find the right package.


It's not that easy to find the right LMS package for download. The packages you'll find on the official site mysqueezebox.com are outdated. Stay away from these.

A good starting point is the official download site.  There you'll find the latest officially released stable releases packaged for each and every platform.

On that site you'll also find a subfolder called nightly.

There you'll find latest so called BETA packages for download.

I always use these BETAs and would also advise you to do so. I never encountered any real instabilities. Actually it's usually been the opposite. 
By using these nightlys you'll get latest bug fixes, updates and new features as soon as these are released.  Currently you preferably go for the 8.0.x family! Current latest is 8.0.0.

Advise:

If you run or intend to run e.g. a NAS system as LMS server, you might face a rather outdated LMS revision being offered by the maintainer. 
Keep an eye on the revisions! It's usually a good idea to have the latest packages installed.
You might be able to update your package manually. Or maybe somebody out there is offering a package tailored to your NAS. 

Since I now brought up the "NAS-as-LMS server" option. Better think twice to go the NAS-as-LMS server route! Using a NAS is usually not the most flexible approach. I've been running NAS systems myself in the past. They do best what they are meant for. Providing a network storage. Times might have changed. The last NAS I ditched I ditched 10 years ago.



3. Installation


The installation part is pretty straight forward on pretty much all platforms. LMS comes with all software needed to be able to run on each and every platform.
I don't want to go deeper into that basic task here. Most of you know how to install these installation packages. Usually you just have to double-click on the downloaded package from your file manager and the system will ask if to install the package.

There are also numerous installation HowTos, Wikis and Youtube videos available for each and every platform. Many of the headless installations need a bit of very basic commandline work from a terminal.


After the automatic installation usually the server starts automatically at boot.
A reboot will always be a nice test to see if things are starting up properly at boot.

Hint:

Make sure you've got all your music data accessible on your OS of choice before your start the LMS installation.

That means the audio data disk needs a mount point and needs to be mounted at boot.
On Linux systems that mount point and the underlying audio data need the right user permissions. Otherwise the installed LMS will not be able to locate the data!

4. Access


Now that the server is running, its user interface needs to be accessed via browser.
All you need is your server IP address.

The IP address you'll find under Windows by doing this

Under Linux or OSX, just open a terminal and type "ifconfig".
It'll list the "inet" address.


To access LMS from any browser connected to your home network enter below line (replace the xxx.xxx.xxx.xxx with your server IP address):

http://xxx.xxx.xxx.xxx:9000

The ":9000" is the port for accessing LMS. It's a mandatory part of the URL!



If the server is NOT up'n running or if your browser-client is not on the same LAN,
you' won't get a connection. No GUI will pop up in the browser!
At this point trouble shooting starts! If you need help, this is the place to go.


Hint:
If you finally managed to connect to LMS and the GUI pops up - bookmark it immediately!


Now, do the basic initial configuration. That's a pretty straight forward task. 
I recommend to skip the "mysqueezebox.com" setup at this stage stage. 
You usually don't need an account that's connecting you to the Logitech universe.

I stepped over one exception though: "Tidal". To be able to run Tidal you need a mysqueezebox.com account to be able to install the related Tidal app.



Finally


It's a good idea - IMO a must - to store/reserve the IP address of the server on your router.
This way you avoid ever changing IP addresses for the server.
You have to login to your router to do that configuration. Pretty much all modern routers offer this feature.



Configuration

While lurking around here and there and talking to this or that person (online), 
I figured, quite some people seem to use LMS with its default settings. Hmmh.

These people just install the package and do some minor adjustments, 
such as changing the path where the music data can be found.

And that'll be it.

It'll work. However. Doing some more adjustments might not be the worst idea.

I do run a setup and configuration session from time to time myself. First comes the initial setup.
Over time there are updates, upgrades. You might add more clients. Or you might play around with this or that.
Due to whatever reason a setting gets changed and you forget to reconfigure it properly.
All this happened to me more than once - and still does!

A good idea is to have a configuration checklist.

Checklist !?!?

Some settings might interfere with your audio listening experience - e.g. by getting flacs 
converted to MP3s without noticing, some others might cause choppy handling on your favorite control app and others might keep your server unnecessarily busy.

Bottom line. I think it's well worth to do these checks initially and once again once in a while.
It won't take you more then 5 minutes.

Below "my way" of configuring LMS.

Note: Below UI screenshots are based on LMS 7.9.1 ( 7.9.2/3 and 8.0 look pretty much the same)


1. Basic Settings








It's pretty self-explaining. Media Library naming is optional. I usually use very short folder names in the root directory .



2. Player settings







Every player/client gets its own player config dialog!
Therefore this exercise has to be done for all your players.

The key aspect of this stage is to disable crossfading!


Note1:
The Player setting dialog for a certain player or client is only accessible 
if that player/client is online and recognized by LMS!!!

Note2:
Any change of HW (MAC address) on the client requires a new Player configuration!



3. My Music - mysqueezbox.com - Interface


I leave these 3 menus alone for now.

I have no intention to connect to the Logitech universe. 
The offered features do not add much - if any value.

However. If you want to use Tidal you need an account on mysqueezebox.com.
Only mysqueezebox.com offers the app that'll allow you to stream Tidal.
You install that app on mysqueezebox.com and then you login with your credentials on LMS.
After that you'll find a Tidal app under applications. While we're at it. Qobuz and Spotify 
are available through plugins.


4. Plugins








As you can see, in this setup I have all Plugins turned off. Most off them do not add much value 
to the way I'm running my system.

The idea behind it:
Better off, then lurking around in the background and potentially causing unwanted and uncontrolled activities.

Meanwhile I use the Material Skin plugin. It's an excellent LMS Web Browser User Interface, which is that
good that it replaced my favorite control apps iPeng amd Orange Squeeze. I highly recommend to check it out!
Make sure you install a most recent LMS version!

5. Advanced - File Types








The "File Types" section IMO is a crucial part of the settings procedure.

In above screenshot you see 3 columns.

1. Input file format
2. Output stream format
3. Decoder

That's your routing and conversion table.
This can get a little confusing for less experienced people. Especially the "one-in" and "several-out" options 
per format are not self-explaining.

Now.

If you have more then one output-stream formats per input format enabled, how
do you know what format gets streamed to your client?

It's not that easy to figure that out!!! You need to understand the logic first.

The streaming client defines which format gets streamed!
The client reports a certain list with a certain list-order of codecs towards LMS.
After the method "first come - first served", it'll be the first reported codec in that list
which defines the output stream format.

If the client reports "mp3,flac,pcm" in that exact order, and all output-stream options 
are enabled LMS will make an mp3 from your flac and streams it down. 
Yep. I've seen people listening to mp3 streams while feeding flacs without noticing.

The challenge.

You won't necessarily be able to identify the clients codec-list order!

This is why you can't be 100% sure what data format gets to your client!!!

If you'd e.g. run squeezelite and you'd have flac and pcm enabled as 
output stream format , LMS would send down a flac stream. Why?
flac comes first in the squeezelite default codec list (hardcoded in source code)

There are two ways to get control over this.

As example a flac shall be streamed as PCM. Your options:

1. You disable flac as output format - as seen in above screenshot.
LMS will have only one streaming option to choose from.
This is the easiest way forward.
However. If you have more then one client this might not be the
best choice. E.g. You might also want to stream flacs "native" to e.g. your phone
You'd have to enable also the flac output-stream option.
That leads to 2.

2. You change the default codec-list order of your client.
Not all clients allow this though. squeezelite does!
Starting squeezelite with option "-c pcm,flac,mp3" changes the default codec
list-order that's being reported to LMS.
LMS would now try to send down a PCM stream first according to above.



I usually stream PCM towards my "audiophile" clients btw.

Why is that?
That keeps decoding and conversion load off my clients first of all.
The downside: It adds some extra load on the network.

I tested all kind of scenarios. Right now I get along best with this.


Now lets talk about the decoder part to wrap all this up.
The decoders are programs that can decode and convert the given data.
These decoders also act as streaming engines.
The main decoder programs are flac and sox. These are standalone binaries supplied
with the LMS package. By using so called custom conversion rules you could e.g. 
use sox to also run samplerate conversions or equalization, basically anything sox 
has to offer you can make use of. And all this is not bound to flac and sox. You can 
even write your own conversion programs. All this is extremely flexible.

I'd like to show you a little more complex example - my setup:





What do we see here?

1. Obviously AIFF and MP3 are disabled.
2. Clients with flac being first in the codec-list get native flacs - no decoding takes place
3. Clients with pcm being first in the list get decoded flacs - decoded by the "flac" binary -
that's what the entry tells us.
4. One client with a particular MAC with pcm being first in the list gets a decoded flac
and that one also gets synchronously upsampled. That's done by a program I wrote
myself called "ssrc1"
5. Another client with another MAC gets decoded and upsampled material by ssrc2

LMS allows to setup conversion rules on a per MAC address basis. That's what I use in my setup.

Obviously my example shows something that advanced users can look into. 
I just wanted to show what's possible. And there's more I could talk about. The whole stuff is extremely flexible.

In Annex 1 I'll give an example how a custom conversion rule would look like.


6. Advanced - Performance







All the settings are pretty self explaining. For a good user experience it is good to have a fast and high performance server in place. I tried to accomplish this with above.





7. Advanced - Software Update








To not have any further activities ongoing and/or to face interference with manually installed
LMS packages, I'd recommend to select settings as outlined above.



NOTE: Do not forget to push "Apply" after any change you'll make!




NetworkingI'd like to make one more note on the networking part. Which is crucial
for a - any - audio streaming network.


use wired ethernet - please NO Wifi on the server
make sure you've got quality cabling in place
make sure u use state-of-the art routers or hubs
make sure these devices run the latest firmware
the only way to make sure the networking is performing well
- and that's key to a streaming network -
you need to run network performance tests - preferably
using the iperf3 tool , which is available on pretty much
every OS platform.


By now I know that many of my readers will skip over this part. Especially if
the whole stuff seams to work.
Advise: Walk that extra mile! It can make a difference.



Summary
All above is no rocket science. Still. It's good to know, and it shouldn't be neglected.

Every time you install, you've been upgrading the server package or you have been adding a new client, you should run that checkup.

There a much more advanced configuration options of how to handle e.g. file conversions and decoding, how to handle this or that plugin. asf. asf.

I leave all that for now.

It's time for you to take decisions and actions regarding your own audio streaming environment.

Good luck with that.

Enjoy.



*******************************************************************************************************

Annex 1: Custom Conversion rules

The file that'll enable custom conversion rules is called "custom-convert.conf".
On Linux systems it's located under /etc/squeezeboxserver on Debian based systems.
On a Windows server system it has to be stored in the LMS main program directory.

If it doesn't exist you have to generate it yourself. Make sure the file has the right permissions and ownership!


In my article about resampling you'll find setup instructions, conversion rules and also my preferred (Case1) resampling setup as an example.



1 comment:

  1. Hi Klaus,
    Thanks a lot for sharing your thorough work. It´s very helpful.
    One question: I run a RPI 4B 8gb piCoreLMS server with squeezelite turned off.
    What would your recommended settings for kernel tweaks be?
    CPU isolation asf.?
    I have noticed, and use, your kernel recommedations for pCP squeezelite streaming clients, but would you suggest using the same settings, if it´s only used as a LMS server with squeezelite turned off?

    BR and thanks in advance, Soren.

    ReplyDelete