How I Built A Spotify Alternative With A Raspberry Pi And Navidrome

Key Takeaways Navidrome offers an ad-free music streaming alternative to Spotify, though you’ll need to use your own audio files. Lightweight and versatile, Navidrome can run on any Raspberry Pi … Read more

Taylor Bell

Taylor Bell

Published on Jul 06, 2024

How I Built A Spotify Alternative With A Raspberry Pi And Navidrome

Key Takeaways

  • Navidrome offers an ad-free music streaming alternative to Spotify, though you’ll need to use your own audio files.
  • Lightweight and versatile, Navidrome can run on any Raspberry Pi SBC, with various installation methods available.
  • Once set up, users can access their music library via a web UI, and customize the experience with additional tools like MusicBrainz Picard.

With its massive catalog of tracks, intuitive UI, and high-quality audio, Spotify is one of the most popular music streaming platforms. However, the app’s subscription model requires you to pay $12 if you don’t want interruptions from advertisements. So, free users will look elsewhere for an ad-free experience.

The Raspberry Pi 5 and its accessories lying on top of a PC

Related

That’s where open-source tools such as Navidrome shine the most. While it does require you to add your own music files, Navidrome supports multiple audio formats and provides access to your music library from any device. And the best part is that you can even set it up on a Raspberry Pi to transform the SBC into a full-fledged music streaming server.

What you’ll need to build your Raspberry Pi-flavored music box

Any RPi board besides the Pico will suffice

A person holding a Raspberry Pi 5 and a Raspberry Pi Zero W

Unlike our NASberry Pi or Windows 11 ARM on RPi projects, Navidrome is so lightweight that you can run it on any Raspberry Pi SBC, including the underpowered RPi Zero series. Since audio files and album images don’t take up a lot of space, you’re free to skimp out on the storage front as well.

However, you’ll need to ensure that you have enough space for an operating system. I chose the Raspberry Pi OS because it’s compatible with all Raspberry Pi SBC models, though you can opt for Ubuntu or other Linux distributions as well. Heck, you can even skip the GUI support and go for a command-line-based distro if you want even more efficiency.

  • A render of the Raspberry Pi 5

    Raspberry Pi 5

  • A render showing the SanDisk Ultra microSDXC card.

    SanDisk 256GB Ultra microSDXC card

Setting up Navidrome can be a bit of a challenge

Though terminal commands make the process relatively painless

Just like installing Nextcloud on a Linux distro, there are a myriad of ways you can get Navidrome up and running on your Raspberry Pi. For example, you can set up a Docker container to host Navidrome, grab the app’s files from select community packages, or even build it from the source repository. However, I decided to go with the default method for Debian distributions as it’s easy to follow and can be wrapped up in a few minutes using terminal commands.

But before I could install the Navidrome package, I had to wrap up two prerequisite steps. If you’re following along, then here’s the procedure alongside its commands.

  1. I started things off by acquiring the ffmpeg library using the apt package manager,
    sudo apt install vim ffmpeg -y
    The terminal command to install ffmpeg

  2. Next, I ran the following commands to set up the necessary folders for Navidrome and modified the permissions for my main user.
    • sudo install -d -o user_name -g users /opt/navidrome
    • sudo install -d -o user_name -g users /var/lib/navidrome​​​​​​​
      The terminal command to modify user permissions for the Navidrome folder

      I left users as the group to avoid creating multiple usergroups on my RPi.

With that out of the way, it was time for me to grab the Navidrome package and install it on my Raspberry Pi.

  1. First, I used the wget command to save the latest arm64 version of Navidrome for my Raspberry Pi 5.
    wget https://github.com/navidrome/navidrome/releases/download/v0.52.5/navidrome_0.52.5_linux_arm64.tar.gz
    The terminal command to download the Navidrome package

    If you’re replicating this project on a Raspberry Pi 3, you’ll have to replace arm64 with armv7. Meanwhile, owners of the original Raspberry Pi and first-generation RPi Zero boards should grab the armv6 variant of the Navidrome package instead.

  2. After that, I used the tar command to extract the contents of the Navidrome package.
    sudo tar -xvzf navidrome_0.52.5_linux_arm64.tar.gz -C /opt/navidrome/
    The terminal command to extract the Navidrome.tar.gz package

  3. Next, I granted my root user the permission to modify the contents of the /opt/navidrome and /etc/systemd folders.
    sudo chown -R user_name:users /opt/navidrome
    sudo chown -R user_name:users /etc/systemd
    The terminal commands to grant modification privileges to the root user

  4. Once the permissions were set, I created a folder called MyMusicCollection and appended the string MusicFolder=“/home/user_name/MyMusicCollection” to the navidrome.toml file to force Navidrome to use this folder as my music library. For reference, this is the command I used to create and edit the config file:
    nano /var/lib/navidrome/navidrome.toml
    The procedure to create the MusicFolder directory for Navidrome

  5. I also used the navidrome.service file that contains the necessary parameters to run the Navidrome web server. If you’re following along, you can simply download my modified text file from this MEGA link and paste its contents into the navidrome.service configuration file. Just like the last step, you can create this file using the following command:
    nano /etc/systemd/system/navidrome.service
    The navidrome.service file with the user name highlighted

    Be sure to switch to your Raspberry Pi user in the config file.

  6. Finally, I ran the Navidrome server with these commands.
    sudo systemctl daemon-reloadsudo systemctl start navidrome.service
    The terminal command to initialize the Navidrome web server

  7. Although optional, I also forced Navidrome to run as soon as I booted my Raspberry Pi by executing this command:
    sudo systemctl enable navidrome.service
    The terminal command to enable the Navidrome server at startup

Accessing your favorite tracks on any device with Navidrome

The Navidrome web UI open on a PC

Once the terminal had executed all the commands, I switched to my PC and typed the IP address of my Raspberry Pi followed by a colon and the port number 4533 to launch the Navidrome web UI. With that, my Navidrome server project was complete, though a couple of things were still lacking.

Since I didn’t have any ripped CDs on me at the moment, I decided to upload some copyright-free tracks to see whether Navidrome worked on my systems. While I didn’t encounter any issues with playing the songs, they lacked the metadata on the artist’s name, album title, year of release, or even a proper image. So, I downloaded MusicBrainz Picard using the sudo apt install picard -y command to fill in the necessary tags and make my Navidrome library more pleasing to the eyes.

An image of the Raspberry Pi 5

Related

These 10 innovative Raspberry Pi projects are the epitome of creativity

Check out some of the most impressive projects created by the Raspberry Pi community

I’ll admit, it was quite a bit of work setting up the project. But thanks to Navidrome, I finally have a fully customizable alternative to Spotify that doesn’t interrupt my songs by playing annoying ads every once in a while. Plus, I don’t have to worry about losing access to my favorite artist’s creations in case Spotify decides to delist them.

Partager cet article

Inscrivez-vous à notre newsletter