Saturday, August 20, 2016

Ubuntu Mytek Brooklyn DSD Setup Guide

Update August, 2018:

These instructions are still valid, but I've gotten direct DSD working as well.  Please visit my updated post here:




I'm happy to report that the Mytek Brooklyn DAC is not only great sounding but it's a real treat to set up with Ubuntu. Why would you care if you are an OSX or Windows person? Because it's really inexpensive to set up a music server with Ubuntu.  From under $100 Raspberri Pi 3 to my own mini box which was under $500. In all cases, an Ubuntu server competes very well with $2,000 or more dedicated streamers. 

One major feature that is missing from a lot of "audiophile" solutions is Android app support.  This is something we will overcome quite easily.

Also, since this is really a driverless installation, these instructions will probably work for any other modern USB 2.0 DAC that claims to be "driverless" for OSX and Linux. The catch will be in setting the right device (SL_SOUNDCARD, below) but that part is easy.

There is a known limitation. Currently Squeezelite only supports DoP, which is horribly bandwidth inefficient. DoP is DSD over PCM. It is not the same thing as direct or native DSD play.

It's not my code, but I'm working on it.

Introducton to the Logitech Media Server

There are a lot of Lunix music players out there, I'm going to go with the easiest one that gives me bit-perfect playback: Logitech Media Server 7.9 and Squeezelite.  You need at least 7.9 to get DSD player support as it's a fairly recent feature. I think it was introduced in 7.8, but I never tried it.

Originally developed for the highly regarded streamers created by Squeezebox and bought by Logitech, LMS has pretty much transcended Logitech AND Squeezebox and now has a robust and active Open Source development community. It's easy to use, convenient and free, and has Android and iPhone apps available. On Android I use Squeezer but on iPhone you can try the original controller app or SlimLibrary.

The one thing that is missing from LMS is a music management feature. It doesn't tag, organize, or do much else but play music. On the other hand, it does this VERY well and without complications. For this you'll have to find another application of which there are legion.

Also, LMS has fantastic and simple Internet radio discovery and playback. It's a real marvel in this manner for which on Linux I have no better alternative, nor do I want one.


Preparation

First, you must have Xubuntu/Ubuntu 14 or greater set up. I am on 16.04 LTS, but 14.04 LTS was identical.  If you have another Linux distro, see the link to the details, below. I will say in the past I used to run Fedora and LMS was one of the main reasons I quit it, so if that's your distro and this is difficult, you have my sympathies. May the gods have mercy on your heathen soul.

Decide where your music and playlists are going to be. I prefer to put public media in /opt, so:

cd /opt
sudo mkdir Music Playlist log
sudo chown bob:bob *

Replace "bob" with your user account name.  Notice we are creating a log directory as well.  This is where any messages from the player (squeezelite) will be put.

Server Installation

First, install LMS from the public repo.  There are only nightly builds but seem pretty stable. You'll find detailed instructions here.

I used this script:
url="http://www.mysqueezebox.com/update/?version=7.9.0&revision=1&geturl=1&os=deb"
latest_lms=$(wget -q -O - "$url")
mkdir -p ~/sources
cd ~/sources
wget $latest_lms
lms_deb=${latest_lms##*/}
sudo dpkg -i $lms_deb

Mine is just a little different because I don't like cluttering up the root directory. This will look for the latest build, download to ~/source and install it.

After it's installed LMS should be running and available on port 9000. So open up firefox and click here:

http://localhost:9000

Follow instructions on the screen.  You'll need to setup your directories. Click on the lower right of the page, "Settings." and setup your music and playlist folders. The only tricky part left in LMS now is to enable the DSD player.  Click on the "Plugins" tab and enable "DSDPlayer."

Very cool part of this is that DSD files will be automatically transcoded if your player doesn't support DSD directly. I have a Squeezebox Touch that does not, so that gets transcoded to 88.2kHz PCM automatically for me.

Make sure your music and playlist folders are universally readable.

Player Installation

OK, that's it for the server.  Now we need to get your PC to talk to the DAC. This is even easier since the Ubuntu distribution includes squeezelite. Let's install it:
sudo apt-get install squeezelite
I've tried the distro version with Ubuntu 14 and 16, and both work great with the Mytek Brooklyn. DSD and HiRes PCM played without a hitch on both so don't feel put out if you don't have the latest version. It's not worth the trouble to get the nightly or the source and build.

Make sure your DAC is now plugged in and turned on.

You'll find the configuration file for Squeezelite in /etc/default/squeezelite.

Here is how I configured it:
# The name for the squeezelite player:
SL_NAME="Brooklyn_DAC"

# ALSA output device:
SL_SOUNDCARD=""hw:CARD=DAC,DEV=0"

# Squeezebox server (Logitech Media Server):
# Uncomment the next line if you want to point squeezelite at the IP address of
# your squeezebox server. This is usually unnecessary as the server is
# automatically discovered.
#SB_SERVER_IP="192.168.x.y"

# Additional options to pass to squeezelite:
SB_EXTRA_ARGS="-D -f /opt/log/squeezelite.log -d all=info"
# As above, but without the log file
# SB_EXTRA_ARGS="-D"


The key part is the SL_SOUNDCARD setting. If you aren't using the Brooklyn, I'm not sure this will be right.  I found it by using "squeezelite -l" and looking for the entry that said :
USB Audio - Direct hardware device without any conversions
There were other entries that worked, but I found they would convert whatever I played to 48/32, no matter the original.

Another important switch is -D which enables playing of DSD without transcoding to PCM.  Without this switch your DAC will always get PCM.

You'll see two versions of SB_EXTRA_ARGS. The first adds a log file, but really once you've got it all working it's not very useful. Once you are happy it's working comment it, and uncomment the last line, then restart.

One last command and you should be running:
sudo service squeezelite restart
Assuming all went well, you should see "Brooklyn_DAC" (set by SL_NAME, above) appear as an available player in LMS on the top right.  Select it and play some music! If you have music but it's not showing up you need to scan your library. Click on the bottom right "Settings" and in the "Basic" tab check the media folder is correct, then click "Rescan" and your files should get imported quickly.

If you need to free up your DAC for movies, or games use the player OFF switch in the LMS screen on the top right.

Now of course it is time to download some good sounding DSD music, for which I highly recommend Blue Coast Records.


Happy Listening!