Run an audio server
If music be the food of love then stop waffling and set up a simple music server that will keep you nourished wherever you are.
Back in 2018 Google announced it would be shutting its Google Play Music service, which gave you free storage for up to 50,000 music files. Combined with its web app for streaming them to wherever you are in the world, this service was (barring whatever shady analytics the company might be doing with data about people’s music tastes) quite a nice thing. Then in May 2020, it announced that shutdown would be happening “later this year” and provided tools to migrate users to its YouTube Music service. But if you want a new cloudy home for your music, one far from the clutches of the Alphabet corporation, consider setting one up on your own.
Unlike streaming video, it doesn’t take much in the way of CPU power to run your own music server. So a cheap virtual private server (or indeed a Mythic Beasts Pi hosting offerings that we mentioned in our cover feature last issue) will be fine. Or you may prefer to host things on your own hardware, perhaps making use of an old machine or a Raspberry Pi.
A popular application for doing tthis used to be the Java-powered, closed source Subsonic (www.subsonic.org). Subsonic can handle video too, but it’s first and foremost a music player. It’ll make easy work of your podcasts and can stream to DLNA, Sonos, Chromecast and various other hardware. It integrates with Last.fm
for audio scrobbling and artist data, fetches lyrics from Chartlyrics and grabs reviews from Wikipedia. And as you’d expect, it handles all kinds of formats, even Flash (shudder). Tagging support is provided by JAudiotagger.
We recommend you check out Subsonic. We’d cover it here, but we can already hear people grumbling about proprietary software. And there hasn’t been a major release for two years. There are a number of forks of it, though (based on the last open source release back in 2016): Madsonic, which used to be open source, is popular. Libresonic, and its 2017 fork Airsonic seem to be the only
FOSS descendants around today. So let’s look at installing Airsonic, which needs Java and Tomcat but will happily run on a Raspberry Pi 3 (although if you have a large music library you probably want to use external storage rather than an SD card).
Get Airsonic up and running
Browse to the Airsonic GitHub page and in the Releases section download the latest .war package, or use the command below (do check for a new version on the releases page) if you’re connected remotely to your box:
$ wget https://github.com/airsonic/ airsonic/releases/download/v10.6.2/ airsonic.war
It’s worth following the official instructions (https://airsonic.github. io/docs/install/war-standalone) and checking the signed checksums too:
$ gpg --keyserver keyserver.ubuntu.com --recv 0A3F5E91F8364EDF
$ wget https://github.com/airsonic/ airsonic/releases/download/v10.6.2/ artifacts-checksums.sha.asc
$ gpg --verify artifacts-checksums.sha. asc
$ sha256sum -c artifacts-checksums. sha.asc
Now install the OpenJDK Java development kit:
$ sudo apt install default-jdk
If you’re installing this on Raspberry Pi it’s recommended to use Oracle’s JDK instead. This method works on Debian 10 and Ubuntu. It’s recommended to install Tomcat as well, but it’s also possible to run the .war archive directly. Before we
“Subsonic can make easy work of your podcasts and can stream to DLNA, Sonos, Chromecast and various other hardware.”
do that though, we need to set up its data directory. Replace youruser and yourgroup below with the username and group you plan on running Airsonic as. Your own username is fine, in which case you don’t need to change the last command. Otherwise you’ll need to prefix it with sudo -u youruser : $ sudo mkdir /var/airsonic
$ sudo chmod -R youruser:yourgroup / var/airsonic
$ java -jar airsonic.war
All going well, you should see screeds of Java output and find the Airsonic login page running on your host at port 8080 (for example, http://localhost:8080 if you’re running locally). Log in with the default admin:admin credentials as instructed. Now, also as instructed, change that password by clicking the link. The next step is to set up media folders. A default entry for /var/music is included, but since this probably isn’t where your music is stored it’s safe to delete this. Add a folder that actually contains your music and give it a name, then hit “Scan media folder now” to begin the fun.
There’s not much you can do while Airsonic is scanning your library, but you can add some users by visiting the Settings page. Even if you’re not going to share your music with anyone, you should set up a non-admin user for yourself. There are quite granular access controls for users, including the ability to limit downloading and sharing. Now would be also a good time to hunt down the Dsub app (originally written for Subsonic) and install it on your mobile devices.
Assuming the library scan is complete you can now browse through your collection and see what Airsonic thought of your naming schemes. We didn’t have as much luck as we did with Plex here, which forgave our genre folders. Airsonic insisted that these were albums too. But things were easily rearranged. Compared to Plex, Airsonic might seem a little spartan, maybe even clunky. But it uses minimal resources (CPU-wise anyway, if you have a large library you might have some difficulties if you’re running on less than a 1GB Pi). Airsonic can help you set up playlists and subscribe to podcasts. And so long as you’ve got ffmpeg installed on the host it can do transcoding as well. Oh, and you can install it as a Docker image too.
If you like the Airsonic approach, but want something that perhaps fits in better with your hosting environment, try looking at Ampache. If you already have a LAMP stack set up then with very little work (cloning the repo and adding a virtual host entry) you can have a PHP-powered music streaming system. You don’t even have to use Apache –
Nginx, Caddy and Lighttpd are supported too.
Bring the funk
Readers familiar with our ways will know we’re all about decentralisation. We’re also fans of funk and whales, so when we read about Funkwhale we simply had to share. Like whales, Funkwhale users can align themselves with a pod. This is a group of users who communicate and share tracks with one another on a particular Funkwhale instance. Like one of our other favourite decentralised things, Mastodon, pods can federate – communicate with one another and discover new connections, music and social groupings. The Funkwhale web client is a PythonDjango-Gunicorn affair and we were pleased to see a Docker image besides a traditional install script. We’d urge you to check it out at www.funkwhale. audio.
And here ends our jaunt into the world of media. Do let us know how your installations go, what you end up watching, and what we should have done differently. Try and not get spooked too, it’s just a trick of the light.