How To Add MUSIC To RetroPie In 5 Commands! (Raspberry Pi)

RetroPie with music
3.8
(9)

So you finally have your RetroPie setup and working. That’s great! but then you realize that things are just a little.. too quiet?!

Let’s add some killer background music to this little rig.

Here I will guide you through the process to add music to Retropie.

 

This post assumes one thing.. that your RetroPie is running on a Raspberry Pi.

 

Once you download and run the script by following the 5 commands you will not only add background music with the ability to turn it on and off from the config menu, but I added some extra functionality too.

 

We can also select an option to: 

  • start playing the music automatically when the Pi boots up, or not
  • we can continue to play the music over the top of games
  • and we can also hide some of the more, shall we say less appropriate music for when the kids get a chance to experience this excellent little gaming box (GTA “Joyride” by Da Shootaz anyone? ;).
 

With all these settings available to us, we’re gonna need a way to see what’s been switched on or off!

For this I created an “info” script, that when executed from Emulation Station front-end config menu, will display what our current state is with our music options.

 

Are you ready? ..Let’s do this!

Contents

RetroPie with music options
Custom config menu showing music options

SSH Into The Pi (For Beginner's)

 

The easiest way to follow along with this guide would be to SSH in to your Raspberry Pi as you can simply copy the commands/text over from this post and paste them into the terminal. To paste text into the terminal, use CTRL + SHIFT + V

Fire up a linux terminal (or what ever system you are rocking) on your PC/laptop and run the command:

ssh pi@ip_address

where ip_address is your RetroPie’s IP Address. It will most likely start with 192.168. It can be found in the config menu of your Pi or by pressing F4 on a keyboard and running the command:

ifconfig 

If you get the response “connection refused” then we may need to turn on the SSH service. To do this we need to get to a terminal on the Pi by pressing F4 on a keyboard. Now run the command:

sudo touch /boot/ssh 

enter the password if prompted (default password is: raspberry)

then reboot the Pi with the command:

sudo reboot 

When the RetroPie boot’s up again we can then try and SSH in to it again. You may need to check the IP address as it may have changed.

If you get a crazy warning that starts with the following:

WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

then copy and paste the line that starts with “ssh-keygen -f ” but add the word sudo at the beginning, and run it.

Type the word “yes” if prompted and enter the RetroPie password if your asked to do so.

Hopefully you’re now greeted with the RetroPie ‘message of the day’ and I’m now assuming you have an SSH session!

retropie ssh login
SSH session to RetroPie

Automated With 5 Commands

Tested on Retropie version 4.5.1

This automated method should have music playing on your RetroPie in just a few minutes!

CAUTION: If you use a USB device for storing your game ROM’s and settings then make sure it is plugged in BEFORE booting up the Pie and before you proceed further with this guide!

Also make sure you have an internet connection and press the ‘F4’ key on your keyboard to bring up a bash terminal or follow the SSH guide above.

Command 1:

Now we need to download the file. Enter the following command into the terminal:

wget https://installtekz.com/downloads/musicpi/music_setup.tar.gz 

Command 2:

Next we need to uncompress the file with the following command:

tar -xvzf music_setup.tar.gz 

Command 3:

Once the file is uncompressed, we need to move in to the “music_setup” directory with the next command:

cd music_setup 

Command 4:

Now we need to make the setup script executable:

chmod +x setup.sh 

Command 5:

And finally, run the script:

./setup.sh 

When the script starts we can hit the “s” key and then ‘Enter’. Wait for the script to finish running and then reboot. That’s it!

If you want to show or hide some menu items that appear in the Retropie settings screen then just run the script once again and choose the “m” option.

Add Your Own Music

To add your own music files then place your mp3’s in: “/home/pi/RetroPie/music/”

(Please use MP3 format only)

 

To use the ‘adult music’ feature then simply rename the mp3 file with the text “ADULT-” at the beginning of the file name. For example: ADULT-song1.mp3

 

If you store your ROM’s on a USB device then you can simply plug this device into a PC/laptop and transfer your music files over.

By using this method then you should see the folder structure as: “RetroPie/music” on your USB device.

 

However, if you have everything stored onto an SD card then this method will not work if you try plugging in the SD card to a PC/laptop.

I would suggest using a file transfer tool such as Filezilla to FTP files across to the RetroPie if you’re a beginner.

Conclusion

My aim for this post was to get you to add music to Retropie on a Raspberry Pi using just 5 commands.

If you’re comfortable with working in the shell then this small project shouldn’t be a problem for you.

However if you’re not that comfortable with working in a linux shell then this would make an excellent little project to carry out.

 

Not to mention that it’s fun! and you will have cool background music over that RetroPie when you’re done 🙂

If you would like some more tips on how you could improve your RetroPie setup then check out my other post “ULTIMATE RetroPie Guide: Tips For Beginner’s“.

New To Linux?

If you’re new to Linux and would like to learn more then why not check out my tutorial posts for beginner’s where I cover the Linux Professional Institute 1 (LPIC1) certification!

The LPIC-1 is a world wide recognized certification that covers all of the basics of Linux Administration and is ideal for Retropie/raspberry pi users.

installtekz icon

Quote Of The Day

installtekz

"When wireless is perfectly applied, the whole earth will be converted into a huge brain..." - Nikola Tesla, 1926

How useful was this post?

Click on a star to rate it!

Average rating 3.8 / 5. Vote count: 9

No votes so far! Be the first to rate this post.

21 thoughts on “How To Add MUSIC To RetroPie In 5 Commands! (Raspberry Pi)

  1. Thank you for adding the undo changes option. My Emulation Station would no longer launch after I ran this script. And even though the script warned me, I didn’t do a backup before running it. (I had a backup, but it was a bunch of revisions ago) I thought I was hosed but running your undo option got it back up and running. I’ve since read in the comments above that Pi4 has some issues, I’ll leave it alone for now. First, time to go do a backup. 😉

    Thanks again,
    Geoff

  2. I just installed this on a 4GB Raspbery Pi 4 powering a PiCade setup on RetroPie Buster 4.7.16. THANK YOU! It worked flawlessly. My setup is on a Kingston 128GB SD card and I am not using a USB drive if anyone wants to use this for a comparison.

  3. Hi
    I can’t seem to access the menu to change the menu entries.
    When I type “./setup.sh” in terminal, it says: ‘No such file or directory.’
    Any idea how I can access this another way, or what I’m doing wrong?

    Thanks in advance!

    1. The file (setup.sh) is not in your path (standard linux). You can use “cd” to change directories and “ls” to look for for it. Or you can download, uncompress and run the file again by following all 5 commands again from this blog post.

  4. Hi
    This works great! Thnx!
    But can i still access the retropie config menu?
    It has been replaced bij your custom music menu.
    All other Pie setup/config options are gone.

    1. 1: run the script again by typing “./setup.sh”.
      2: Select “m” from the menu and press “enter” (“Add/Remove Menu Entries”).
      3: Press “y” or “n” then “enter” for each option. (“Show: Audio Settings? ” etc.)
      4: Exit the script by pressing “q” from the menu.
      5: Check that it has worked. (may need a reboot)

  5. Hi, I Think i was using this with my pi 3, but with 4 it seems to crash or lose gamepad and most of the menu items disappeared from the emulationstation setup after installation. Is there an easy way to unistall this?

    reinstalling emulationstation did not work.

    1. Thanks for the feedback. I don’t currently have a Raspberry Pi 4 and so I can’t look into this as of yet. Yes I created the script with an option to “uninstall” by restoring as much as possible back the way it was, but this has only been tested on a Raspberry Pi 3 . You can do this by selecting “Undo All Changes” from the scripts menu.
      There is also an option in the menu to “show/hide” these menu options.
      If anyone else has any comment on this then it would be appreciated.

    2. Same problem, When I start Retropie I get this error just before Emulation start: “Failed to start dphys-swapfile – setup mount/unmount and delete a swap file retropie” I can’t add new games, save or do anything else since I installed this script, it all stays as it was when I installed it. I also have a Pi 4 … I don’t know if all this information helps, but I hope we have a solution to this error soon 🙁

    3. I think I understand this problem. If you use a USB drive for storing all of your games etc. then you need to have it plugged in before you run the script. This is because Retropie uses TWO possible “places” to store the mount folder (on USB or on SD Card) and it can’t use both at the same time.

      It’s been a while since I done this but what I think happens is when Retropie boots up, it looks for the “RetroPie” folder on SD Card first to load up your settings. If the system doesn’t find this folder on the SD card it then looks for it on the USB drive.

      You can try re-naming the ‘mount’ folder to see if the system detects the other ‘mount’ folder.
      1. go to the command line (F4)
      2. Run the command: sudo mv /home/pi/RetroPie /home/pi/RetroPie-backup
      3. reboot
      4a. If this has not fixed the problem then change the folder name back: sudo mv /home/pi/RetroPie-backup /home/pi/RetroPie
      4b. reboot

      If the system still detects 2 swapfiles then you may need to find and delete it in the RetroPie folder or delete the folder all together rather than renaming it to RetroPie-backup. However there’s a risk you may loose data!!

  6. Hi,

    I just installed this on my retropie setup running on a ubuntu 20.04 machine, everything installed correctly, but inside of retropie (emulstation) there is no music.

  7. Hey. I can’t find the music folder from the \\retropie on my PC…I would like to delete the test music and add my own…what am I doing wrong?

    Thanks!

    M.

    1. I am guessing that you are not using an external USB device for storing your ROMs and you are keeping all files on the SD card? Try copying your mp3 files onto a USB device, plug the USB device in to the retropie, then copy/move the mp3 files over to the music folders.
      I hope this helps. (it’s not easy to explain if you don’t know linux)

  8. The script worked beautifully, thank you!

    However, some UX feedback, disabling a bunch of Retropie menu items by default is troublesome. I’m happy you documented it here and gave the -m option, but default, it shouldn’t be taking away options. 🙂

  9. Hello, great tutorial.

    Is there a way to play the music but have it stop playing once you select an operating system (Arcade, MAME, NES, etc…) so we can hear the game snaps (video/audio preview). Then have it start playing again once we get out of the operating system.

    Or is there a way to add a music option (operating system) to Retropie like an operating system but rather than selecting games to play we can select music to listen too?

    Thanks again for your knowledge and time.

    Regards,

    E

    1. Hi thanks for the comment.
      This project started to get very complex and so I stopped where I thought would be a good point for this first version.
      However, I might review this in the future. At the moment, there isn’t a music track selection feature but I would look into this at a later time.
      I’m not sure I fully understand your first question but there is an option to either play the music over the games or to pause the music while the game plays. Just select the setting “Continue Music Over Games” ON/OFF

      Hope this helps

  10. Thank You for this. As a complete novice there where a few things that were a challenge but this was exactly what I was looking for. Once I gained a little knowledge I was able to get it all work just fine. Now onto volume controls.

Leave a Reply

Your email address will not be published.