brainbaking/content/post/2022/03/how-to-stream-your-own-musi...

9.6 KiB
Raw Blame History

title date categories tags
How To Stream Your Own Music: Reprise 2022-03-05T14:30:00+01:00
retro
software
music
audio codecs
navidrome
self-hosted

This is a follow-up to my own February blog post, How To Enjoy Your Own Digital Music. After thinking this through, buying a NAS, and playing with it, now is the time to answer my own question: how to enjoy your own digital music collection nowadays?

Pinky swear it'll be my last post on self-hosting. For a while.

The Why

The local record store owner told me I was the exception when I bought GZA's Liquid Swords on CD. Almost all rap enthusiasts swear by LPs/vinyl---it's going through a real renaissance period. Most new LPs are priced at €30 or more, and some older more obscure underground stuff is really hard to get. You guessed it: yet another hobby to sink too much money into. On the other hand, (digital) CDs are dirt-cheap. Liquid Swords cost me €6.90. Ridiculously cheap---but that's a 1995 album. Most others are priced at around €17. Since I mostly listen to music while working (behind a PC) or on the road (in the car), I prefer digital audio.

While just relying on ripped .mp3 files on your local HDD suffices, it's nice to have the ability to stream those. For me, the main advantage is having the collection available on-the-go, provided a music client has offline play capabilities. My smartphone's disk space is small, and I don't like having to re-copy/upload albums every so often. Yes, I've been spoiled with Spotify-like streaming services. It's damn handy, I'll give them that! A second advantage is easy sharing with family members.

The How

Enter Navidrome, a blazing fast "personal streaming service" that acts as your local Spotify server. It has been running in try-out mode for a few weeks here, and so far, I'm pretty impressed. It's simple, small, consumes little resources, can handle huge libraries, and immediately detects file changes. Do not expect the polish present in the current Spotify client though: the HTML5 client still has missing features (no universal search, no decent gapless playback, ...)---but still. You don't have to rely on their default client.

To install Navidrome using docker, simply use the offical Docker image. If you have a Synology NAS, it's very easy: install the "Docker" application from the Package Center, click "Registry", find Navidrome, double-click to download. The only thing to configure is the volume; create a new shared folder called music and mount it at path /music. Done! Now the app should be available at your server IP:your local port (see screenshot below, mine's not set to "auto" but hard-coded at 9977):

If you want to create a clean URL as an alias, set up the reverse proxy: go to Control Panel, click on Login Portal, tab Advanced, click on Reverse Proxy. Fill in the source (HTTP, hostname cd.yourhost, port 80) and destination (HTTP, hostname localhost, port the local one set up in the Docker settings, mine's set at 9977). This will not suffice, you also need a DNS server that tells you yourhost is actually your local server IP. Synology has a built-in DNS server (search for "DNS Server" in the Package Center), or you can rely on something like a Pi-Hole.

Great, now it's time to start populating that music folder! The location does not matter---Navidrome will auto-scan that path. After a while you can enjoy the music through a browser by simply surfing to http://cd.yourhost/:

If you don't like the fact that it's a web app, no worries. Navidrome implements the Subsonic API, meaning all other music streaming clients that are compatible with Subsonic1 are also compatible with Navidrome. Here's a list of apps currently compatible with the Navidrome server. So far, I've tried:

  • Subtracks for Android---a great looking app but no download play;
  • Sonixd---a desktop client based on Electron that is slow, has issues with text rendering and doesn't listen to dedicated next/previous key buttons;
  • Substreamer for Android and iOS---a mature smartphone app that fulfills all my wishes.

Linux users could also check out Sublime Music built on GTK. I haven't found a decent dedicated client for MacOS yet besides SoundWaves that I have yet to try. A great overview of selfhosted music clients can be found on GitHub. Some have true gapless playback, some feature download play. I really like Substreamer:

It worked perfectly with Bluetooth in the car, it has light/dark modes, it can download albums if you want to keep your server local without having to open up a VPN tunnel, and it is very responsive. The iOS client is also good.

The What

What to take into consideration when converting your CDs into .mp3 files? Navidrome and its clients heavily rely on M3U meta tags. A music tagger such as MusicBrainz Picard, MP3Tag, or Beets is essential if you want to keep your library nice and clean. Picard and Beets rely on the online MusicBrainz database to auto-collect and upload metadata, which is a nice bonus in case you don't like typing it all out for yourself. That database is amazing, it even contains information about obscure Flemish compilations!

A few random tagging tips for Navidrome:

  • If your CD is a compilation, set the compilation tag to 1. Add albumartist as Various Artists if needed. For now, under the "Artist" tab, Navidrome can only search for albumartist tags. Search by song if you're looking for an artist on another compilation CD.
  • If your album contains multiple CDs, set each discnumber accordingly, and if needed, add a disctitle. This will automatically show up in the Navidrome web app, but as far as I've tried, not be picked up by Substreamer.
  • Think twice about the genre contents. It's a great way to quickly filter your collection.
  • Dig up a cover.jpg file for each album, there's no need to embed it into the file itself, although it's possible.
  • The comment tag is displayed below the album art. Go nuts!

As for the ripping itself, well... I still rely on my trusty WinXP machine and yes, still use Audiograbber with lame.exe. Instant retro vibes! Remember to enable the SMB1 (Samba v1) sharing protocol on your NAS if you require file access from a retro computer---version 2 and 3 are the standard nowadays. The LAME encoder comes with a few presets, of which probably only two are of use in 2022:

  • The --preset insane option: a constant bit rate of 320 kbps. The absolute highest quality but largest files. Average album sizes: 140 MB.
  • The --preset extreme option: a variable bit rate of around 260 kbps. Still very high quality, I can't hear the difference and usually settle with this. Average album size: 105 MB.

The jump in quality from 128 kbps to 192 (and especially higher) is huge. It's up to you whether or not to exaggerate: if you have the space, why not. The Bandcamp albums are still downloaded as .ogg (+/- 190 kbps), but the option to download larger files is there.

One last thing: invest in a good headset and speaker! The speakers of a MacBook or your average smartphone are laughably bad when trying to enjoy something with a deep bass or subtle tone differences. Over-ear Bose headphones are good enough for me, and the noise cancellation works wonders when my wife insists on watching TV. I realize better (and more expensive) options are available. I've enjoyed Sony in-ear buds too---while they lasted, before breaking down completely. Navidrome supports Sonos speakers through another daemon service, but I haven't tried that yet. Most of the heavy lifting is still done by the Pioneer box as seen in my office setup.

And that's how you stream your own music. Don't forget from time to time to dig through your CD collection and effectively use the CD itself on your retro Hi-Fi installation to sit down, relax, and do nothing but enjoy the music.


Addendum 8th March: I am officially an idiot. Who still manually tags their music files? Compared to other CD rip software, Audiograbber is extremely limited, yet I didn't know better. After reading Williams' enjoying music curation again post, I tried the Linux command-line tool abcde---yes, the Retroxp machine is dual-booted----which can be configured to automatically download (and embed) album art, fill in M3U data, rip simultaneously in multiple formats, etc.

And it worked like a charm! Details on how to use it can be found in William's post. Here's my .abcde.conf file:

ACTIONS="cddb,read,getalbumart,encode,tag,move,clean"

OUTPUTTYPE="mp3"
LAMEOPTS="--preset extreme"

WAVOUTPUTDIR=/tmp
OUTPUTDIR="$HOME/Music/"
OUTPUTFORMAT='${ARTISTFILE}/${ALBUMFILE}/${ARTISTFILE} - ${TRACKNUM} - ${TRACKFILE}'

PADTRACKS=y
EJECTCD=y
MAXPROCS=2

CDDBMETHOD="musicbrainz"

# see http://frozen.ca/automatic-cd-ripping-with-abcde/
mungefilename ()
{
  echo "$@" | sed s,:,\ -,g | tr / _ | tr -d \\"\?\[:cntrl:\]
}

Happy (semi-)automated ripping!


  1. The Subsonic development was stopped, hence Navidrome as the spiritual "successor". ↩︎