Moving from Spotify to a self-hosted music streaming server
Hi, fellow datahoarders. I’ve recently decided that I’m going to cancel my Spotify subscription and move to a self-hosted music streaming solution. This isn’t going to happen overnight, I love my music so I need to prove my self-hosted solution is 100% capable before I cancel my Spotify subscription. To be completely honest, I may even keep my existing Spotify subscription. It’s really convenient, it does a great job of suggesting new music and it doesn’t cost of fortune in the grand scheme of things. You’re probably now wondering why I’m building a self-hosted alternative.
Why build a self-hosted Spotify alternative?
I’ve been with Spotify for years now, and credit where it’s due, it’s been great. The problem, however, is that like with any streaming service, you don’t own or control the content (the music and podcasts in this case). This means that for a whole host of reasons, you could suddenly find your favourite content has disappeared. For example, an artist or label could decide they no longer want to have their music on Spotify and it could easily be gone.
“Cancel culture” is also becoming a worry across the board. It could be that an artist is caught up in some scandal and suddenly all of their music is removed from the platform. It seems today that there are thousands of people sitting around waiting to feel offended at something or other. If for example, enough of them decided they feel offended by a particular podcast episode and take to Twitter en-masse to complain, more than likely the “offensive” content will be removed without question.
Fortunately, I’ve been hoarding MP3’s and FLAC’s of my favourite music and podcasts for a number of years. If I can catalogue and ingest all of these into my own streaming server, I no longer need to worry about content disappearing from Spotify. I don’t mean to paint Spotify in a negative light by the way. All the other big players (Amazon Music, Apple Music, Deezer, Pandora, SoundCloud, Tidal, etc) are in the same boat and afraid of any backlash from the “Woke brigade”.
Options for the self-hosted streaming server
I was hoping to find an open-source music streaming project that I could adopt. After a little research, it seems that there is no “de-facto” best solution. There are a number of different open-source projects but none of them are perfect and to be honest, the landscape seems quite fragmented. I can’t help but think that if all these developers could get behind one project, they could make something amazing that would leave the commercial systems standing. Instead, they’re all working against each other on their own little projects. I’m not sure why this is, perhaps there’s some ego involved and a belief that their system is the best. I decided to start with, I would try to find what seemed to be the most popular solutions and then narrow down my choice from there.
The five most popular music streaming server software solutions
It’s difficult to gauge what the “most popular” anything is really, especially when it comes to software where the number of users isn’t published. I spent some time reading the forums and Reddit and made a tally each time a particular music streaming solution was recommended. This gave me a list of five, at least somewhat popular music streaming software projects:
It seemed the most recommended solution was Plex. Of course, we know Plex is hugely popular when it comes to video (TV, Movies, etc) streaming and it seems some users love it for its music streaming ability too. For me, however, I decided it wasn’t the right choice. I’d decided that my chosen solution needed to be open source and Plex does not meet this criterion. On top of that, I couldn’t shake the feeling that Plex was really designed for video and that its music streaming ability was an after-thought.
Subsonic has been around for a while and seems to have a loyal user-base. It streams music reliably using its own protocol and by all accounts, it has the best selection of mobile apps, something that’s important to me, having become so used to Spotify’s slick app. Again, unfortunately, I discovered that Subsonic is no longer open source. Frustratingly, Subsonic used to be open source but since version 6, beta 2, it’s now closed-source and is distributed under a commercial licence. I’ll have to pass on this option too!
Airsonic is more or less the open-source equivalent of Subsonic. It’s a fork from the last open-source Subsonic codebase and has been in development for a number of years. Some people say that it’s not as good as Subsonic, others say it’s better. I decided to get a true picture, I was going to have to at least install Airsonic and give it a quick trial. I’ll get to that later on.
Funkwhale is a relative newcomer to the world of self-hosted music streaming. The first release of Funkwhale was around five years ago but it’s only recently reached version 1.0 and is now considered “stable”. From the screenshot on the Funkwhale website, I really liked the look of the interface. Inspired by Grooveshark, it looked fresh and neat. I must admit, I had a couple of reservations, however. I didn’t like the fact that it described itself as being a “social platform”, giving you the ability to join other’s music “pods”. Also, according to its blog, the project is looking for “maintainers” as the original developer is stepping away from the project. I decided to give it a try nonetheless and will get to that later.
Ampache seems to have a decent fan-base. It was recommended dozens of times across the various music forums and subreddits. It takes its name from “Amp” (as in amplifier) and “Apache”. In case you’re not aware, Apache is a well-regarded web server, usually used for serving web pages and their media. Apache has been around forever, I’ve installed it hundreds of times and am pretty familiar with it. For these reasons, I had high hopes for the Ampache music streaming server. I headed over to their website, where they host a live demo to play with. Sadly, I was unable to bond with the interface. It felt clunky and dated when compared to Spotify and its competitors. I decided not to trial Ampache at the moment. I like the fact that it’s based on Apache, has been around for twenty years, and is stable, but something about the interface just doesn’t please me.
Airsonic vs Funkwhale
From my five initial candidates above, I’d managed, rightly or wrongly, to dismiss three of them out of hand. I, therefore, needed to trial the two remaining contenders, Airsonic and Funkwhale. Fortunately, they both have Docker images available so it shouldn’t be too arduous.
Installing the Funkwhale docker image is fairly straightforward if you have a little experience with Docker or are willing to spend a little time reading up on it. I won’t document the whole process as there’s an official guide that’s fairly comprehensive. It can be found at https://docs.funkwhale.audio/installation/docker.html
Issues with Funkwhale
Lack of album art
The only real issue I came across was that after installation and configuration, Funkwhale wasn’t showing my album art. I’d imported a few albums as a test, but no images were showing:
I wasn’t sure what was causing this, I thought perhaps it was a browser security setting or an ad-blocker but tweaking these didn’t help. I tried Funkwhale in some other web browsers but that didn’t help either, the album art didn’t show. I re-read the documentation and it definitely stated that if the album art was embedded into the ID3 tags/metadata (which it was) that it would be pulled from there. Eventually, I redeployed the Docker image along with all configuration, assuming I must have misconfigured something. Again I had no luck, even trying older versions of the Docker image in case the latest version had a bug.
I inspected the element that should have contained my album cover and this is what I saw:
That’s right, for some reason Funkwhale has hard-coded the path to the image without specifying the port number!
This image file doesn’t exist, yet if I append the port number to the hostname, we get this positive result:
I assume this is because I’m not using a load-balancer with Funkwhale, as I’m just testing it within my home network. To work around this issue, I restarted the Docker image, telling it to listen directly on port 80 and setting the NESTED_PROXY variable to “0”. I didn’t bother updating my docker-compose configuration file, I instead started the instance directly with this command:
docker run --name=funkwhale -e FUNKWHALE_HOSTNAME=deb6.home -e NESTED_PROXY=0 -e PUID=998 -e PGID=998 -v /srv/funkwhale/data:/data -v /var/music:/music:ro -p 80:80 funkwhale/all-in-one
You can find more information on the parameters and environment variables here: https://github.com/michaelmob/docker-funkwhale
After making the change, and accessing Funkwhale on port 80, I was pleasantly surprised:
As you can see, not only is the album art now showing, but the whole interface looks quite nice. It reminds me of Grooveshark or even early Spotify.
Incorrect artist showing on albums
The eagle-eyed among you may have noticed from my screenshot above that there’s a slight anomaly in Funkwhale when displaying the artist on albums that are credited to Various Artists. For example, you can see that I have two compilation albums that I’ve imported into Funkwhale, “Now That’s What I Call Music! 46” and “Greatest Hits of the 80’s”. Both of these albums should clearly be credited to “Various Artists”, but that’s not the case. Funkwhale has Britney Spears as the artist for Now 46 and Hot Chocolate as the artist of Greatest Hits of the 80’s:
It happens that the tracks by Britney Spears and Hot Chocolate are the first tracks on the two incorrect albums. I thought that perhaps MusicBrainz Picard had incorrectly set the MP3 ID3 tags of these albums. This was not the case sadly, as that would have been an easy fix. As you can see, this track along with the other tracks that are part of the album have the “Album Artist” field correct set to “Various Artists”:
I tinkered with things for 10 minutes but it wasn’t obvious that any of the settings were incorrect. After wasting a couple of hours on the earlier issue with the album art missing, I didn’t have the appetite to continue with this issue and decided to live with it for now.
Now it was time for me to install Airsonic to see how it compared to Funkwhale. Hopefully, I won’t need to fix the Album art or make-do with having incorrect artist names on compilation albums.
After browsing the Airsonic documentation, I wasn’t thrilled to learn that Airsonic runs on Java. For reasons I won’t go into, I don’t much care for Java applications or the Java runtime in general. Fortunately, however, like Funkwhale, Airsonic also has a Docker image available to speed up deployment. This allows the Java runtime dependencies to run inside the Airsonic Docker container so that we don’t need to pollute our host environment.
The documentation for installing Airsonic looks fairly good, the Docker specific instructions can be found here: https://airsonic.github.io/docs/install/docker/
I tweaked the suggested Docker command that’s listed in the above article. You’ll notice that instead of creating a new Docker volume to hold my music, I instead used a volume bind, to map my local music repository (in /var/music/) to the Airsonic Docker instance. This has a couple of benefits. Firstly, it’ll save on storage space as I won’t have two copies of my music. Secondly, it means I only have to manage one copy of my music library which can potentially then be accessed by a number of other music streaming solutions at the same time.
The command I used was:
docker run -v data:/airsonic/data –mount type=bind,source=/var/music,target=/airsonic/music,readonly -v playlists:/airsonic/playlists -v podcasts:/airsonic/podcasts -p 4040:4040 -d airsonic/airsonic
You’ll notice I also used the “readonly” attribute on my volume bind because I didn’t want to risk Airsonic messing up my neatly organised and tagged music collection!
First Impressions of Airsonic
I fired up my web browser and logged into the Airsonic instance. I was pleased to see that it had already scanned my music folder and was showing the album art. The interface felt a little bland however:
That ugly-looking “Welcome to Airsonic” text banner is slightly off-putting too. I played around with the settings for a while, changing my theme from the default to “Groove”. I managed to remove the welcome text too (you’ll find this under Settings > General). It looks slightly more appealing I think, yet it still has a legacy/retro feel that I can’t quite explain. If you used to browse the Web in the 1990’s/2000’s you might get the same vibe:
Issues with Airsonic
I can’t really say I’ve found too many serious flaws with Airsonic. One little gripe however is that the list of artists in the left-hand pane is incorrect. This seems to be listing the artists only of albums, not of individual tracks. You’ll see in the above images, it says I have 245 songs in this test library, but only 2 artists. This is clearly wrong as the Now 46 and Greatest Hits of the 80’s have hundreds of different artists between them. I would’ve liked them all to be listed individually. Perhaps there is a configuration change that I can make to fix this but I haven’t noticed it yet. On the plus side, searching for a specific artist does seem to work as expected, so they are being indexed properly at least:
Well, I have to be brutally honest, I’m not blown away with either Funkwhale or Subsonic. Don’t get me wrong, they both seem to work OK but they just lack the finesse of some of the cloud-based services like Spotify. Perhaps I’m being unfair in that comparison. After all the two solutions I trialed are free and open-source and Spotify is a massive corporation with thousands of employees and a huge budget.
My next steps are going to be:
- Sign-up to last.fm and setup scrobbling on both Funkwhale and Airsonic.
- Download and trial some phone apps (I’ve heard good things about “Ultrasonic” and “Audinaut“.
- Try to use Airsonic and Funkwhale for a week and not touch Spotify.
After that, I’ll see how things stand. I might decide to trial a few other solutions (I’m warming to Ampache slightly). I suspect, however, that whichever solution I settle-for, I’ll continue to let my Spotify subscription renew. If there’s a music streaming project that I’ve overlooked that you would recommend then let me know!