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 114.4k 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.
    • J
      jozzy1
      last edited by

      Great guide. Thanks!

      1 Reply Last reply Reply Quote 0
      • R
        roci
        last edited by

        Great guide and works perfectly! I do have one small problem though, I installed Moonlight into Retropie and once I launch it the music just continues :/

        does anyone know a fix for that?

        ExarKunIvE B 2 Replies Last reply Reply Quote 0
        • ExarKunIvE
          ExarKunIv @roci
          last edited by

          @roci

          i dont use this method to have background music, but here is the start of this way here

          got through and maybe someone asked a similar question

          RPi3B+ / 200GB/ RetroPie v4.5.14, RPi4 Model B 4gb / 256gb / RetroPie 4.8.2
          RPi5 4gb / 512gb / RetroPie 4.8.9 -Basic
          Maintainer of RetroPie-Extra .

          1 Reply Last reply Reply Quote 0
          • B
            backstander @roci
            last edited by backstander

            @roci

            I installed Moonlight into Retropie and once I launch it the music just continues :/

            I think this is because Moonlight is launched directly and not through the Runcommand like every other emulator in RetroPie. So basically runcommand-onstart.sh and runcommand-onend.sh are not called.

            does anyone know a fix for that?

            You might need to manually edit your Moonlight.sh script and add "pkill -STOP & -CONT mpg123" to it.
            Something like this (I haven't tested it):

            #!/bin/bash
            pkill -STOP mpg123
            moonlight stream -app Steam blah blah blah...
            pkill -CONT mpg123
            
            1 Reply Last reply Reply Quote 0
            • L
              Lumpeidi
              last edited by

              Hi,

              This works all fine! Thx!
              But i have a question.

              I have many songs in the rome file.
              Also i set a startsong for the first boot from ES.
              This all works great.
              Song play at start and than random music.

              But i wanna have a second "startsong" who plays if i leave the game /emulator.

              for example:

              RPI3 boot -> ES Starts -> Startsong "A" plays -> after song, random music starts -> Start game -> exit game -> Startsong "B" plays -> after song, random music starts

              can someone help me?

              System:

              • RPI3
              • Retropie 4.2.16
              1 Reply Last reply Reply Quote 0
              • L
                linkreincarnate
                last edited by linkreincarnate

                @MapleStory

                Could this be used to give audio control to google assistant? I have it working in desktop mode but during emulation station bootups it cannot grab the audio control because the audio device is busy (presumably being used by emulation station itself) I wouldn't even need it to check for emulators running to reduce the volume because I would want the google assistant to be able to output during gameplay

                1 Reply Last reply Reply Quote 0
                • HyruleslinkH
                  Hyruleslink
                  last edited by

                  Thank you for posting this guide, I just implemented the music player on my build and it works great!

                  1 Reply Last reply Reply Quote 0
                  • C
                    Cjax08
                    last edited by

                    I’m curious how this works in a set up with video snaps. Will the music pause or fade out when you are previewing a game video in the game select list? Or will it play over it and I should just wait until this is ironed out?

                    fnkngrvF 1 Reply Last reply Reply Quote 1
                    • S
                      SSimmers
                      last edited by SSimmers

                      I believe I might've missed something or typo'd somewhere. RPI3 starts up and song starts in the 10 seconds. Go into game and when I exit said game, mpg123 does not continue at all. How do you go about editing this sort of thing? Thanks! ^.^'

                      Edit: I had checked and found that "[[ $(tty) == "/dev/tty1" ]] && pkill mpg123" was typo'd and missing a "K" in pkill. However that didn't resolve the issue.

                      jonnykeshJ 1 Reply Last reply Reply Quote 0
                      • jonnykeshJ
                        jonnykesh @SSimmers
                        last edited by jonnykesh

                        @ssimmers In /opt/retropie/configs/all/runcommand-onstart.sh it should say:

                        pkill -STOP mpg123
                        

                        In /opt/retropie/configs/all/runcommand-onend.shit should say:

                        pkill -CONT mpg123
                        
                        S 1 Reply Last reply Reply Quote 1
                        • S
                          SSimmers @jonnykesh
                          last edited by

                          @jonnykesh Awesome! That's exactly what it was. For whatever reason, I had "/pkill -CONT mpg123". No clue why I hit the forward slash the first time around. Thanks!

                          jonnykeshJ 1 Reply Last reply Reply Quote 0
                          • jonnykeshJ
                            jonnykesh @SSimmers
                            last edited by

                            @ssimmers Not a worry. Happy to help.

                            1 Reply Last reply Reply Quote 0
                            • fnkngrvF
                              fnkngrv @Cjax08
                              last edited by

                              @cjax08 no, this still plays because it is an independent application running. What I have done to deal with this is I have re-encoded all the audio files that I use in my builds to be set at 50-60% gain. This allows for the audio of the video snap to come through clearly while you can still hear the bgm "behind" it for lack of better term.

                              1 Reply Last reply Reply Quote 0
                              • fnkngrvF
                                fnkngrv
                                last edited by

                                anyone notice an issue where if you use the commands in bash script that music doesn't start up again when you go back into ES from terminal?

                                1 Reply Last reply Reply Quote 0
                                • COOL_IRONC
                                  COOL_IRON
                                  last edited by

                                  Is it possible to create custom launch file for specific rom that will not disable music?

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

                                    @cool_iron YES and NO

                                    I created two bash files that Continous or Disable Background music by using USER MENU from runcommand. If you launch a ROM then the grey box apperas... Press a button and you enter the runcommand menu list. Now you can enable/disable Background music by using User Menu item.
                                    Take a look here and add a exit 2as last line!

                                    The way I descripe is not 100% the method you asked here - it's a small workaround. Of course it is possible to add music for a specific ROM.... You can modify this code and add to runcommand-onstart.sh

                                    COOL_IRONC 1 Reply Last reply Reply Quote 0
                                    • M
                                      monstergubl
                                      last edited by

                                      i have done all commands on the rp3 direct
                                      my big problem is where is the folder that i was created , when i type in mkdir /home/pi/bgm it say to me the folder already exists. But i cannot find the Folder on my PC or USB ...

                                      1 Reply Last reply Reply Quote 0
                                      • COOL_IRONC
                                        COOL_IRON @cyperghost
                                        last edited by COOL_IRON

                                        @cyperghost I did not quite get it past the user menu step.
                                        What should I do next? Can you explain this more please?
                                        Maybe you could add some pictures?

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

                                          @cool_iron
                                          Add 2 bashfiles to dedicated folder descriped in the Wiki: runcommand functions
                                          One with pkill mpg123 -STOP and the other with pkill mpg123 -CONT to User Menu. One file is called Stop BGM.SH the other is called Continue BGM.sh
                                          Then you select one oft these files in User Menu and can manually enable or disable music. If you follow the link that I gave you to the bash script then you can automate the process by using a custom collection as trigger event.
                                          But this needs some coding skill...

                                          Feel free to ask ;)

                                          COOL_IRONC 1 Reply Last reply Reply Quote 0
                                          • COOL_IRONC
                                            COOL_IRON @cyperghost
                                            last edited by

                                            @cyperghost Oh, sorry, I didn't read the topic of this discussion :P
                                            The problem is that I am using different method for background music. Is it possible to make this two .sh scripts woking with this method?

                                            cyperghostC 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.