RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    Quick and easy guide for adding music to Emulatonstation on RetroPie. Noob friendly!

    Scheduled Pinned Locked Moved General Discussion and Gaming
    musicbgmsynackguide
    165 Posts 59 Posters 116.6k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • BobHarrisB
      BobHarris @mitu
      last edited by BobHarris

      @mitu This change in the script (-l 0 instead of -Z) is actually very helpful.
      I now have another build with no music in the bgm folder except for the Sony ps1 bootup sound. With this script you hear it only once when booting and then it's all quiet. :-)
      It might become my new main build if I get tired of my playlist.

      Pi 3B , 64 GB Sandisk ultra flashdrive, 19 systems, 872 hand picked classic gaming gems :-) Dual shock 4v2

      mituM 1 Reply Last reply Reply Quote 0
      • mituM
        mitu Global Moderator @coldnpale
        last edited by

        @coldnpale Ok, I got to run a test and this is what seems to work:

        1. Make a .m3u file with the names/paths of the mp3 files:
        /home/pi/music/file_start.mp3
        /home/pi/music/file2.mp3
        /home/pi/music/file3.mp3
        ...
        
        1. Run mpg321 with:
        mpg321 -l 0 -@ path_to_m3u_file
        

        replacing path_to_m3u_filewith the actual path of the m3u file.

        coldnpaleC 1 Reply Last reply Reply Quote 1
        • mituM
          mitu Global Moderator @BobHarris
          last edited by

          @bobharris If you only have 1 file, then just running mpg321 /path/to/mp3file would be enough, i.e. no parameters would be needed.

          BobHarrisB 1 Reply Last reply Reply Quote 2
          • BobHarrisB
            BobHarris @mitu
            last edited by

            @mitu Ok thanks!

            Pi 3B , 64 GB Sandisk ultra flashdrive, 19 systems, 872 hand picked classic gaming gems :-) Dual shock 4v2

            1 Reply Last reply Reply Quote 0
            • coldnpaleC
              coldnpale @mitu
              last edited by

              @mitu thanks a lot! I'll check this as soon as I am back home!

              1 Reply Last reply Reply Quote 0
              • FinnbroF
                Finnbro
                last edited by

                I have a couple questions involving this bgm method, would be interested if anyone has any input.

                1. I've been wanting to modify this where it starts a new song after exiting a game, instead of resuming the same song. My current fix was to edit the /opt/retropie/configs/all/runcommand-onend.sh to be the exact same as the autostart.sh in the same folder. This effectively reloads RetroPie every time I exit a game, and while it does give me the intended effect of playing a new song, it is a bit inconvenient with the extra loading time and not resuming from the same place I was in the games menu. Anyone know of a more elegant method?

                2. Does anyone know of a script where you can have a button that sets a different folder for bgm music, as well as some kind of skip button? I have the on/off button enabled in my RetroPie menu thanks to /u/columboscoat over on /r/RetroPie, but these extra options would be fantastic additions to my build. I have a folder for chiptunes and a folder for remixes, would be awesome to be able to switch them on the fly. I've done some research on the ins and outs of mpg123, but it is way over my head.

                Thanks in advance.

                cyperghostC 1 Reply Last reply Reply Quote 0
                • cyperghostC
                  cyperghost @Finnbro
                  last edited by cyperghost

                  @finnbro said in Quick and easy guide for adding music to Emulatonstation on RetroPie. Noob friendly!:

                  I've been wanting to modify this where it starts a new song after exiting a game, instead of resuming the same song. My current fix was to edit the /opt/retropie/configs/all/runcommand-onend.sh to be the exact same as the autostart.sh in the same folder. This effectively reloads RetroPie every time I exit a game, and while it does give me the intended effect of playing a new song, it is a bit inconvenient with the extra loading time and not resuming from the same place I was in the games menu. Anyone know of a more elegant method?

                  That easy to do.
                  modify /opt/retropie/configs/all/runcommand-onstart.sh with pkill mpg123 > /dev/null 2>&1
                  This terminates mpg123 if you start a ROM

                  modify /opt/retropie/configs/all/runcommand-onend.sh with mpg123 -Z /media/usb0/BGM/*.mp3 > /dev/null 2>&1 &
                  The /media/usb... thing represents the path were the mp3 are deployed

                  Does anyone know of a script where you can have a button that sets a different folder for bgm music, as well as some kind of skip button? I have the on/off button enabled in my RetroPie menu thanks to /u/columboscoat over on /r/RetroPie, but these extra options would be fantastic additions to my build. I have a folder for chiptunes and a folder for remixes, would be awesome to be able to switch them on the fly. I've done some research on the ins and outs of mpg123, but it is way over my head.

                  Als no problem. Trigger a GPIO event that terminates mpg123 and restarts it with annother folder path. That's a kind of "SKIP" function.
                  Sadly mpg123 is a bit limited with controls but it's enough imho for a BGM player.

                  FinnbroF 1 Reply Last reply Reply Quote 1
                  • FinnbroF
                    Finnbro @cyperghost
                    last edited by

                    @cyperghost Thank you so much for the quick response! I will try this stuff and report back if I need further assistance.

                    1 Reply Last reply Reply Quote 0
                    • V
                      vj88
                      last edited by

                      Hi everyone!!!
                      I have a problem with this... splash screen won't play over e.s. loading screen! Emulation always starts at splash screen end. I know that the problem is this method cause it doesn't wait without it!
                      Any help please?
                      Ps sorry for bad english
                      Thanks.

                      coldnpaleC A 2 Replies Last reply Reply Quote 0
                      • coldnpaleC
                        coldnpale
                        last edited by

                        It happens for me also like that.. I thought it was supposed to be like this. It's not a big issue but would be nice to save some more time.

                        1 Reply Last reply Reply Quote 0
                        • cyperghostC
                          cyperghost
                          last edited by cyperghost

                          Did not see .... I once gatherd some interesting sniplets that can be very usefull for music control.

                          This script Toggles mpg123 - so if mpg123 ist not running it will be started. If it's running the process will be stopped. If the process is stopped it will be continued!
                          The other script Plays annother track. This is simple the same procedure as I posted to @Finnbro - It kills the mpg123 process and restarts it with parameter -Z.

                          Be aware to change pathes to your MP3 or playlist collection.

                          1 Reply Last reply Reply Quote 0
                          • Z
                            zerojay
                            last edited by

                            You can use that with the script that allows you to run commands with combinations of button presses to do all that on the fly.

                            1 Reply Last reply Reply Quote 0
                            • AlturisA
                              Alturis
                              last edited by

                              Interesting. Going to try these loops as "music"

                              Arcade Background noises
                              http://arcade.hofle.com/

                              RP 4.7.1 • Pi4 4Gig • CanaKit Aluminum • 64GB microSD • 1920x1080 BarTop [2 Sanwa sticks]

                              cyperghostC 1 Reply Last reply Reply Quote 0
                              • cyperghostC
                                cyperghost @Alturis
                                last edited by cyperghost

                                @Alturis
                                I don't want to hijack the thread
                                So I created a new BG-Music on Retropie - Post your favourites here

                                1 Reply Last reply Reply Quote 0
                                • coldnpaleC
                                  coldnpale @vj88
                                  last edited by

                                  @vj88 said in Quick and easy guide for adding music to Emulatonstation on RetroPie. Noob friendly!:

                                  I have a problem with this... splash screen won't play over e.s. loading screen! Emulation always starts at splash screen end. I know that the problem is this method cause it doesn't wait without it!

                                  Anyone else having this issue? Is it normal or can it be avoied?

                                  1 Reply Last reply Reply Quote 0
                                  • FinnbroF
                                    Finnbro
                                    last edited by Finnbro

                                    The above scripts are helpful, thanks!

                                    1 Reply Last reply Reply Quote 0
                                    • BriganeB
                                      Brigane
                                      last edited by Brigane

                                      I have a problem getting both mp3 and video snaps playing at the same time. Also the in-game sound is gone.
                                      I think the reason is that the audio source is busy playing the audio (mp3) and it can not handle the video snaps and mp3 files simultaneously for some reason.

                                      This also happens when I use your image @dmmarti (Motion Blue V5) with the included background music script. Do you have an idea what I can do?

                                      I'm using a USB Sound Card such as this one https://www.ebay.com/itm/PC-Win7-Mac-Vista-H1-3D-Virtual-Audio-Sound-Card-Adapter-USB-2-0-7-1-Channel-/152624039538

                                      Any thoughts?
                                      Any help or thoughts are much appreciated.

                                      Systems: Raspberry Pi 0/2/3 Model B+
                                      Os: RetroPie 4.5
                                      Frontend: Emulationstation & Attract Mode

                                      1 Reply Last reply Reply Quote 0
                                      • W
                                        westleigh77 @TMNTturtlguy
                                        last edited by

                                        @tmntturtlguy I had the same thought. It's been a year, thought I'd check in to see if anyone's come up with a solution

                                        1 Reply Last reply Reply Quote 0
                                        • E
                                          edwardthehuman
                                          last edited by

                                          installed this succesfully, but it mutes the game music/sounds entirely when i enter it. any solution?

                                          BriganeB 1 Reply Last reply Reply Quote 0
                                          • BriganeB
                                            Brigane @edwardthehuman
                                            last edited by

                                            @edwardthehuman

                                            This is kind of the same problem I'm having. Do you use a USB sound card or just HDMI?

                                            Systems: Raspberry Pi 0/2/3 Model B+
                                            Os: RetroPie 4.5
                                            Frontend: Emulationstation & Attract Mode

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                                            Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.