How I set up my own Google Music alternative.

Matthew Wilber
5 min readOct 3, 2020

--

Originally published on GreenZeta.com October 1, 2020

Beginning October of this year, Google will shut down its Play Music service. This isn’t the first time Google has shut down a service that I frequent. Back in 2013 I started up my own Tiny Tiny RSS server after Google Reader was shut down. Google offers YouTube Music as an alternative. It may be good for some, but it’s missing many features I need: No caching for offline playback and interstitial advertising are my primary points of contention. I can pay $10 a month to alleviate those shortcomings. But that’s a lot of money to access a music collection I’ve already paid for. I’m not a huge music lover, I have my collection and that’s what I listen to. Occasionally I add to it and I’m happy to pay for the tracks that I do. But I have no interest in an unlimited catalog, not when it’s a monthly subscription.

I set out looking for alternatives that met the following criteria:

  • Accessible from anywhere
  • One-time or no fees
  • Ability to load my own content
  • Web playback
  • Server-side playlists
  • Android app
  • Ability to cache locally to the android app

A subscription is out of the question, so Spotify and its ilk are not for me. Plex was my first choice. I’m an avid Plex user for video, so I already have the server set up at home. However, Plex requires fees to access my library over the internet. It’s a good choice, but I would prefer something that’s natively on the internet.

There are plenty of other roll-your-own music servers available so I started digging through them. Subsonic, and it’s open-source alternative Funkwhale appear to be the top choices. However, both require installation of a service. No different than Plex, but that would make me largely beholden to the developers of those respective projects. I could figure out Funkwhale’s python source if I needed to but it’s not something I’m particularly proficient in.

Ampache

My search didn’t last long before I happened on the Ampache project. Written in php, it installs right on my existing LAMP server. It also makes the code easily editable if I ever need to tweak something. It has a Subsonic compatible api so it will work with any Subsonic compatible mobile app. That met all of my requirements and then some. One additional benefit is it supports Dropbox as a data source. I’m able to use my existing backup library as a CDN!

Setup and installation is not much different from WordPress. Just create a MySql database, put your connection info in the config, and run the web based installation page. Setting up the Dropbox plugin is done through the web admin. However I came across one problem very early on. When pointing to a Dropbox account, the catalog engine would stop cataloging my audio files after the first 200 or so. Re-run and it just goes over the same files again. That was a show stopper since my music folder has over 4,000 files in it. Fortunately, I found an easy fix.

I don’t know the history behind Ampache’s Dropbox support, but the api implementation appears to be very rough. I imagine it’s not something high on the list of priorities for the project. Maybe it was something with my configuration too, I honestly don’t know. But it appears as though Ampache was designed to use a local folder as its primary source. The trick to my solution is that Ampache uses the same data table for its file records regardless of where the media comes from. When I set Ampache up on my local server, I was able to completely catalog the entire library. The Ampache database is flexible enough that you can move it from instance to instance and it still works. So after cataloging my entire library locally, all I had to do was run two SQL UPDATE commands, one to change the catalog ID from the local one to the dropbox one, and another to update the file paths. Once I did that it worked perfectly on my web server!

Custom Theme

My only complaint about Ampache is its web interface could use a lot of UI/UX polish. Fortunately, it supports themes. I copied the default theme and spent some time cleaning it up. I thought it would take me quite a while but the templates and stylesheets are very well organized. I also updated a good portion of the icons with a flat monochromatic look, largely stolen from Fontawesome. My theme is a work in progress and I’ve put it on GitHub.

Conclusion

Ampache is a great solution for a web developer looking to host their own music server. If you can install WordPress, you can install Ampache. I’m going to continue working on the GreenZeta theme to make it more complete. Right now it doesn’t support dark mode, nor optimized for mobile screens. Once I get more comfortable with the inner workings, I plan on taking a look at the Dropbox plugin to see if I can fix the 200 file issue. For now, I set up an additional catalog on Dropbox for any new tracks I want to add. Ampache does a good job of integrating the various catalogs seamlessly. However I would like to help out on the project if I can and that looks like a good place to start.

--

--

Matthew Wilber
Matthew Wilber

Written by Matthew Wilber

A professional web developer for over 15 years. For more information, visit greenzeta.com and get the latest updates @greenzeta on twitter.

No responses yet