Monday, August 28, 2017

LogitechMediaServer - Settings Guide

Let's start with a bold opening statement: 

I consider the LogitechMediaServer (LMS) the best music server software out there.
I'll explain the "Why" in a minute.

The LMS is the server part - as its name suggests - of a very powerful client-server audio streaming environment. 

LMS requires a compatible streaming client, such as the widely known and spread squeezelite application (opensource GNU PL)  which runs pretty much on all platforms





With this article I'd like to share some hopefully useful background information and setup advise that might get you going.  



Intro

Let's start having a look at the client-server audio streaming architecture.
The server manages the 
music collection, images, it handles the networking, the streams and commands towards the clients.
The server also talks to your control app on your phone or web browser.

It offers tons of plugins, e.g. a Tidal or Qobuz plugin, a DOP/DSD native plugin, a convolution engine asf. asf..

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


To do a satisfactory job the server needs quite some horsepower under the hood. I am running a Broadwell i5 NUC btw. That doesn't mean that e.g. a RPI or a NAS wouldn't be able to do the job. A lot of stuff just gets slower, partially annoyingly slower, and some tasks won't work at all. If you have a RPI or whatever SBC or NAS around just give it a try.
If you're happy with such a setup stay with it. I tried it. Such a setup wouldn't work for me. 


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. 

1. You keep that server away from the actual audio room and audio system
2. You don't have to sit in the music room (living room in my case) to do all kind of
     config and maintenance work. 
3. Running CPU hungry DSP work, such as resampling or convolution, working with large        collections, managing several clients will put high demands on a server. 
    You don't want to have all that running on the same machine as your playback client
4. Your streaming client can become really slim
5. You can keep the server close to the router, especially if you don't have ethernet cables
    in your 
home. A server shouldn't be limited on its network interface.


That's why I usually recommend to put the server on a rather powerful server PC and let the clients run on a small SBC (single board computer), such as a RPI. I use my server also as my everyday desktop PC btw.



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. Quite some community contributors (maintenance/features/plugins) are still active. 

Bottom line. The LMS project is very much alive - in 2018!


LMS alternatives:


The LMS approach is IMO much more sophisticated then solutions based on widely available UPNP/DLNA. Many audio streaming device manufacturers offering UPNP endpoints. That's all but sophisticated! For them it's rather easy to build though!

Then there are numerous Music Player Daemon (MPD) based OSes (Moode, Volumio etc.)  out there. The MPD server functionality is far less sophisticated than the LMS architecture.

Non of them is IMO able to compete with LMS.


Then there are commercial solutions from e.g. Roonlabs which come with tons of features at an hefty pricetag ($500 lifetime or 119$ a year!!). I am wondering what supposedly justifies
that pricetag.

Then you'll find Max2Play on the commercial side. 

I'm not really sure what value these add.


I'd highly recommend to try LMS! Get used to it. And than you might also try Roon. They offer a 14 day trial period. That gives you plenty of time to make up your mind.


And please also consider this:
More and more people, and that includes me, are using WEB based streaming services for casual listening, parties, etc. . and the related streaming apps from Amazon Music, Qobuz, asf. on the phones are pretty sophisticated and come with tons of features. 
With such a nicely made audio streaming app at hand it's a no-brainer to beam a stream from your phone over to your favorite Bluetooth or Airplay device/DAC. Who needs a streaming client, server and especially third party commercial software for that job!?!? 


LMS and squeezelite - as a server and client solution - I basically use exclusively for serious listening of my own and local music collection

Yep. That's my actual use case, nothing more and nothing less.


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 just need a bit of configuration via web-browser. 

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 can compete with 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. 
And then these devices are sold at breathtaking pricetags. Great business models! 

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 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 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 )


2. 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. 


3. It's fast and stable

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


4. 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, UPNP asf. asf.

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


5. 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.  

6. Community

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




More LMS related info you'll find on the LMS Wiki.

And that - the Wiki - is IMO one of the downsides of the LMS universe.
I do think all this online documentation
needs some maintenance.



Installation 

1. Platform

I'd recommend a Linux platform like Ubuntu. You can install Ubuntu first (also as Dual Boot system) and then LMS.

Of course Windows and OSX will also work.

Meanwhile you even have options to enable LMS on ARM e.g. piCorePlayer on RPI 3B(+). 
It works. OK. But, as I mentioned, it's not my choice. And shouldn't be yours.
The RPI is not the best platform to handle complex tasks, huge databases, much network traffic and that  all at once (the same is IMO valid for rather low steam NAS systems!).  
You'll get annoyed -  sooner or later - I promise! Been there, done that.

At least from my experience I'd say the best platform is a rather powerful Intel platform. 
Even an aged PC or Notebook will do better than a RPI as server.

However. Do not  believe that MPD based standalone solutions (Moode, Rune, Volumio, DietPi) do much better than LMS+squeezelite on a RPI.  

If you put too much load on a SBC/RPI nothing will work satisfactory!


2. Software 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.

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 so called latest BETA packages for download.
I use these BETAs and would also recommend to do so. I never encountered any real instabilities. Actually it's usually been the opposite. By using these nightlys you'll get bug fixes, updates and new features much earlier.

Advise:
If you run or intend to run e.g. a NAS system as LMS server, you might have to live with 
quite an old (outdated!) LMS revision. I doubt they won't offer nightlys. Customization might also get a bit tricky. So. Better think twice if to go the NAS-as-LMS server route! 




3. Installation

It's pretty straight forward on pretty much all platforms. LMS comes with all software needed to run on each 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.
There are also  numerous installation HowTos, Wikis and Youtube videos available for each and every platform.


After the installation usually the server starts automatically . 
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 installation.


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. It's straight forward. I'd recommend to just skip the "mysqueezebox" stage - it's not needed for most people!



Finally. 

It's a good idea to store/reserve the IP address for 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 option.


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.
They 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: All below UI screenshots are based on LMS 7.9.1 ( 7.9.2 looks 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 gets its own player config dialog. You'd have to do the task for all your players.

The key aspect of this stage is to disable crossfading!

Note1: 
The player setting dialog for a certain player is only accessible, if that player/client is online!!!

Note2:
Any change of HW (MAC address) requires a reconfiguration!



3. My Music/ mysqueezbox.com/ Interface

I leave these 3 menus alone. 

Just to mention it: I'm not using mysqueezebox.com. It just adds more complexity.
During installation you should skip the "mysqueezebox.com" step!



4. Plugins







As you can see, 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 hanging around in the background and causing unwanted and uncontrolled activities.

If I add new tracks, I just run a rescan (clear and rescan) manually.



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 list-order
           as written.  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!



Summary


All above is no rocket science. Still. 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 some more advanced configuration options of how to handle e.g. file conversions and decoding. 
I'm also using different startup scripts. No SystemV, I use systemd. 
I'm also using different sox and flac binary (these helper binaries as supplied by LMS are not always bleeding edge).
I might cover these advanced confurations at a later point - this would be command-line work and applies to Linux based servers only.


I hope the above can give a little guidance on how to approach LMS .


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 a Windows server system it has to be stored in the 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.

 



3 comments:

  1. I noticed that you disable FLAC decoder for FLAC files, just send PCM. With your setting my Rpi with Allo Piano dac play it fine but with FLAC higher than 16/44 my Osx Sqeezeplay client gives an unsupported sample rate error, it work fine if i enable FLAC decoder. What is the difference to send PCM vs FLAC?

    ReplyDelete
    Replies
    1. If flac is converted to PCM on the server and at the same time gets upsampled on the server, squeezelite requires the "-W" option to work!
      Otherwise it'll fail!
      Native samplerate flac->pcm at up to 384kHz should work, if your DAC or the DAC driver supports it.
      Make sure you have the latest server and squeezelite installed.

      Delete
  2. Hello Klaus!
    Do you know any ways for convolution with lms besides inguz?
    thanx
    Sascha

    ReplyDelete