An Amazing DIY Raspberry Pi Music Player

In this tutorial, I will be going through steps to making your very own Raspberry Pi music player. This process is pretty straightforward, so you shouldn’t come across any problems at all.

Raspberry Pi Music Player

For this project, I am going to be using a pre-built software package called the Pi Musicbox. This software contains plenty of features & functionality that make it great as a Music player.

This project is a headless music player so you will need to use a different device to be able to control it. The good thing is you can pretty much use any device that has a browser to be able to interact with it.

The Raspberry Pi is perfect for this type of project as it requires very little power to operate. This means you can keep it on 24/7 and easily turn on music when you feel like listening to some cool beats.

Equipment

The equipment that you’re going to need for this Raspberry Pi music player is listed below. I have also made a mention of a few devices you can use to get better audio from the Pi.

Required

Raspberry Pi

SD Card or Micro SD Card if you’re using a Raspberry Pi 2, 3 or B+ (8gb+ recommended)

Ethernet Cord or Wifi dongle

Optional

Raspberry Pi Case

USB Keyboard

USB Mouse

External Hard drive or USB Drive (For storing local music)

Now since this project is completely based on audio, it might be worth getting a USB Audio Card or a Raspberry Pi sound card.

There two supported add-on audio card brands and they are HiFiBerry and IQAudio. (These both typically require the GPIO pins) however, most audio cards that are built for the Raspberry Pi should work as this is based on Raspbian.

Video

If you want to see how to do this project visually, then be sure to check out my full video below.

It goes through all the steps to getting this setup and working correctly in no time at all. If you do like the video be sure to subscribe or follow us on social media, so you stay up to date.

Adblock blocking the video? Support us by subscribing to our ad-free service.

Installing Raspberry Pi Music Player

To get this project up and going we’re going to be using a pre-built image. This process is a pretty straightforward process and won’t take too long to do at all.

Download & Format the SD Card

1. First, we need to download the Pi Music Box zip from their GitHub or from our file server. (It’s called something like musicbox_v0.7RC7.zip)

2. You are also going to need a formatting tool. To get one visit the SD Association’s website and download SD Formatter 4.0 for either Windows or Mac.

3. Follow the instructions and install the formatting tool.

4. Now insert the SD card into the computer or laptop’s SD card reader and check the drive letter allocated to it, e.g. G:/

5. In the SD Formatter tool, select the drive letter for your SD card (e.g. G:/) and then press format.

SD Formatter

Install the Pi MusicBox Image onto the SD Card

1. Firstly, if you don’t already have it then download the Win32DiskImager.

2. Now unzip the Pi Musicbox ISO file so you can install it onto the Pi safely.

3. Select the Pi Musicbox ISO file and the drive letter your SD card is assigned (Eg. G:/)

4. Confirm you have the correct details and click on Write.
Win32DiskImager
5. If you’re using a WiFi dongle, you will need to make a quick edit to the settings.ini file. This file can be found on the SD card we just wrote to. Simply go to the SD Card and open up the config file and then open up the settings.ini file. If you prefer to setup your WiFi manually, then see my guide on it setting up the Raspberry Pi WiFi via command line.

6. In here add the wifi network name and the wifi password next to the correct fields and then save and exit.

7. Once you are done, eject and remove the SD card from your computer.

Booting/Setting up the Raspberry Pi Music Player

Now we’re all good to connect everything up and turn the Raspberry Pi on. Now we will be opening up the Music box in a browser, so it’s very important that you have an Ethernet cord or WiFi dongle connected. (The WiFi dongle required a bit of extra setup mentioned above)

To connect to the Raspberry Pi music server, open up a browser and enter the following URL.

http://musicbox.local

If this doesn’t work or you’re using an Android device, then you will need to use the IP of the Raspberry Pi. If you have your Pi connected to a screen you should be able to see the IP in the command line.

Once connected, in your browser you should be presented with a screen like the one below.

Pi MusicBox UI

I am just going to mention some of the things you can set up so now go to settings. You will find the settings in the following order.

Music Player Settings

Network

In here you will find all the network settings you will need to correctly setup the Raspberry Pi music player.

  • Wifi Network name: This is the SSID or the name of your WiFi network you wish to connect to.
  • WiFi Password: The password required to access the local network.
  • Workgroup: This is the workgroup name of the local Windows network.
  • SSH: Only turn this on if you need to edit the Pi remotely via the command line. Check out the SSH tutorial if you need more information on using SSH correctly.

MusicBox

In here you will find general settings for the Musicbox. You probably won’t need to change any of these, but I do highly suggest updating the root password to the device.

  • Device Name: This is the name of your Pi and how it would be called on your local network. Change this if you wish it to be something different to “musicbox”. Keep in mind changing it will change the URL in the browser to the new name.
  • Autoplay Url: You can enter a URL here to start a radio station or stream for when the device boots up. If it doesn’t automatically start, you can increase the wait time to a little higher.
  • Wait Time: The time it waits before playing the autoplay URL after boot. The time is in seconds.
  • Root Password: By default, the root password to the device is “musicbox” this should be changed to something more secure especially if you are going to enable SSH.
  • AirPlay Streaming: This allows you to stream directly from your iOS device to the Raspberry Pi Music Server. When enabled, this device should show up in your AirPlay device list.
  • DLNA/uPnP/OpenHome Streaming: If you need to stream over any of these protocols, then enable this.

Audio

  • Initial Volume: This is the volume that the device will start at by default.
  • Audio Output: Here you can manually select the output for the audio.
  • Downsample USB: Enable this if you’re having trouble with the quality of the audio. Typically, if you’re on a Pi B+ or newer, you shouldn’t have to turn this on.

Music Files

  • Scan Music Files: Enable this if you would like to scan for music files on boot. However, you could find that this slows down your boot time considerably.
  • Network Drive: If you have a network drive setup that has all your music in it then you can set it in here. Make sure you enter the correct username and password.
  • Resize Filesystem: This setting is very important if you’re looking to make the most of your SD card. Once you enable this and reboot, you will gain access to the entire SD Card.

Services

If you’re looking to use services such as Spotify, YouTube, Google Music, SoundCloud and much more, then you will need to set them up in here. The setup for each of the services are pretty straightforward and are often explained if any extra information is required. More services may be added in the future.

That’s all the information you should need for setting up the music player correctly. There are a few things you should probably be aware of that I will quickly mention below.

Other things to note

Now with the Pi Music Box, there are a few things that are mentioned you should probably be aware of.

The software package is not secure enough to be run outside a firewall. Keep this in mind if you decide to connect to a public Wifi spot, or you’re on an insecure internet connection.

The passwords for the Spotify service and the WiFi connection are stored in plain text on the SD-card. You can avoid the WiFi issue by setting it up manually and not use their inbuilt system, but there is no workaround for the Spotify service.

You should change the root login password if you decide to turn SSH on. As I mentioned above the password is default so anyone who knows of the music box software can easily gain access to your system if SSH is enabled. (However, they would need to be on your local network)

If you want to access the mopify GUI instead of the Pi MusicBox GUI you can simply enter the following into your browser.

musicbox.local/mopify

Again replace the musicbox.local with the IP of the Raspberry Pi if the hostname is not working. Once you have connected successfully, you should get a screen like the one shown below.

Mopify UI
Mopify is a GUI designed for Spotify only so if you want to use the other services then you will need to use the Pi music box GUI.

I hope you now have a fully working Raspberry Pi music player up and running. If you do come across any troubles, have feedback or anything else then be sure to drop us a comment below.

28 Comments

  1. Luc on

    I am looking to get a advanced shuffle function where each song of my collection of MP3 is played once , no more, until the shuffle has played the entire collection. Then I can restart and all the songs are once again played just once .. no song left out, no song played twice 🙂
    is your player capable of this? If not, anyone knows of such a music player for the RP?

  2. Michelle A Gabutti on

    The latest version works ok out of the box except I can not get Spotify to stream on the Mopidy-Mopify browser.
    Any help?
    Thanks

  3. Anthony on

    Hi

    I have a pre-installed noobs on my sd card. If I format the card wouldn’t that erase everything on the card including the NOOBS? For this to work would you suggest getting a new sd card or is there a way to download the musicbox image without wiping the whole card?

  4. Peter on

    has anyone got wifi (onboard or dongle) to work on the RPi 3?

  5. Dustin on

    What is the Mac alternative for Win32DiskImager? Made it to that step and got let down. Please let me know! Thank you!

    1. Gus on

      Try using etcher, you can find it here: https://etcher.io/ (It’s Windows, Mac and Linux)

  6. Douglas Borba on

    Comment
    When accessing the mopify and trying to link my spotify account appears the following error message:

    Something went wrong …

    Looks like Spotify did not return the correct tokens. Please close this window and refresh Mopify.

    Invalid_grant: Invalid redirect URI

  7. Simo on

    Can I use this as a chromecast audio replacement so I could stream audio from my spotify app on my android to my speakers?

    1. Callum on

      Yes

  8. dan on

    will this affect my noobs system

    1. Callum on

      Yes it will remove everything on the sd card

  9. Allan on

    Hi,

    Can this app autostart and play spotify and other broadcast sites when i power on the raspberry?

    Regards,

  10. Ben Capshew on

    Hey Gus,

    Thanks a lot for this tutorial! I seem to be missing something after using the “Raspberry Pi 3 Extra Steps’ since I can’t get mine working on built-in Rpi3 wifi. Do the steps for the wifi dongle need to be followed as well? I can access mine using ethernet but once I unplug it doesn’t switch to wifi. I’ve entered the wifi settings in both the GUI settings and in the .ini.

    1. Gus on

      Sorry I should of mentioned even with the workaround the on-board WiFi won’t work. It will only get it to boot. Still waiting to see if they will update the core Pi Music Box image but it has been over a year.

      There is some information here on the WiFi however i can’t say how well it will work.

      https://github.com/pimusicbox/pimusicbox/issues/357

  11. AshwinRaam on

    Hi , i tried exact steps as mentioned above for the pi 3 but it did not work can some one help me i am new to pi

    1. Gus on

      I’ll install it on the Pi 3 over the next couple of days and see if I get the same issue.

      I’ll let you know how I go.

    2. AshwinRaam on

      Thank you in advance, if possible text me the result to…..

    3. Gus on

      Hey AshwinRaam,

      I had the same problem but have worked out how to fix it. I have added the solution to this tutorial under the title “Raspberry Pi 3 Extra Steps”

      Let me know if you run into any problems!

    4. Reddy on

      how to connect to spotify

  12. GChang on

    How can I setup another RP2 as a music server attached with a USB HD that can be accessed by a linux PC as well?

  13. GYC on

    just installed with USB soundcard laying around, great sound, thanks for this excellent video/instructions

  14. Alex on

    Hey, I have a problem. Mine says DHCPDISCOVER and a duration and in the end it says no dhcpoffer received. If you wait a few minutes the pi music box starts succesfully with an ip and all. However, I cannot connect by any means to it (even with ip) and if I ping 8.8.8.8 it says cannot resolve hostname (a.k.a. No internet access?). Help me please

  15. Justin on

    My phone and tablet do this a lot easier, and it has a graphic user interface, not dismissing pi as an awesome tool , but this seems very convoluted.

    1. Braedon on

      Justin Pi’s cost like 40 dollars, an iPad costs several hundred…

    2. john on

      You have the lightest Pi for about 10 bucks, seems like a great deal for a music player.

  16. Todd Maddison on

    Is there an app one can use to control this via android phone? Having to open a web browser on a phone seems a bit clunky….

  17. Janar on

    Just finished building it… Awesome!

    Thanks Gus!

    1. Miguel on

      Gus,

      I just finished the setup as per your directions and everything seems to have worked fine, except that MusicBox does not ‘see’ my USB drive where my music is stored. Did I miss a setting somewhere?

      Thanks and regards,

      Miguel

Leave a Reply

Your email address will not be published. Required fields are marked *