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

    Background Music [Continued from Help/Support]

    Scheduled Pinned Locked Moved General Discussion and Gaming
    musicbgm
    343 Posts 109 Posters 331.3k 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.
    • C
      Concat
      last edited by Concat

      In autostart I put:

      emulationstation & 
      while pgrep omxplayer >/dev/null; do sleep 1; done; 
      mpg123 -f 5000 -Z /home/pi/Music/*.mp3 >/dev/null 2>/dev/null &
      while (ps x |grep -v grep |grep -c "emulationstation")>0;do sleep 1; done;
      pkill mpg123; exit
      

      This makes sure emulationstation loads while the video splashscreen is playing, and then as soon as the video is over, mpg123 plays. No more ES load screen.

      The script monitors processes for the string "emulationstation". As soon as it gets no results, it kills mpg123. This ensures when you exit emulationstation, you don't get stuck in the script with the music playing

      -f 5000 is for volume. See above.

      I'm a total noob, so this is just cobbled together from some googling. I have no idea if this is very efficient.

      fellegF W 2 Replies Last reply Reply Quote 0
      • fellegF
        felleg @Concat
        last edited by felleg

        @Concat That's a neat idea! However, I only have one problem. When my video plays, I can see the white borders of EmulationStation loading in the background (my video is a square shape). What could fix this? Also, strangely, the music does not start at all when ES is launched.

        I started writing this post before you edited yours, so I only have tried the first three lines of your code. I also get the black screen upon editing ES, which you mentionned in your post before editing it. Fortunately, just pressing enter makes the terminal active again.

        I'd like to implement your code, but so far it brings more problems for me. If I find what I was doing wrong, I'll let you know. By the way, neat find about the volume control for mpg123! I looked in their manual, and -f is to "scale". There is no mention of volume anywhere, it's like they made it cryptic on purpose :P

        Edit: just FYI, I used -f 20000 instead of -f 5000 for mpg123 as you wrote in your post. I think 5000 is not loud enough ;)

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

          @felleg
          Hey, the video splashscreen just renders on top, so that's why you can see the white of ES around it. I assume the easiest fix would be to just make a 16:9 video so it fills the screen.

          I'm not sure about the other issues you're having. Did you only just try to implement this, or was it working for you before? ...what version of RetroPie are you running? ...and are you sure you put the music into the right folder? If you look at my code, you'll see I have mine in /home/pi/Music

          As for volume, I wasn't recommending 5000, that's just what I have. Maybe the track I have is just really loud.

          This page lists the arguments: https://linux.die.net/man/1/mpg123

          I see a few RVA arguments that sound like they normalize the volume from track to track. I will probably try to include this as well.

          1 Reply Last reply Reply Quote 0
          • D
            dragon3gabriel
            last edited by

            Sorry to ask again, but is there away to get Livewire's script to pause when booting up PPSSPP emulator the way it does for every other emulator. Can't seem to find a solution anywhere for this.

            anasazi29A 1 Reply Last reply Reply Quote 1
            • GTR_BOSSG
              GTR_BOSS
              last edited by

              Can anyone help.

              I have the background music all up and running thanks Livewire.

              The problem I have is ports.

              When I run Streets of Rage Remake the background music does not stop.

              I have added "sorr" in the emulators list and still does not work.

              Does anyone have a way to fade the music in the ports section please?

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

                I know this topic is huge, but Livewire's script is a year old. If you look you will see that @synack came up with a much simpler solution that will probably solve both of your issues. Retropie was updated not too long ago with support for runcommand-onstart and onend user scripts. Those scripts can be employed to turn off the music.

                I'm not sure anyone is still tweaking Livewire's script.

                Should probably be a new topic really, since it's very confusing to switch the discussion to a different method half way through.

                GTR_BOSSG 1 Reply Last reply Reply Quote 0
                • GTR_BOSSG
                  GTR_BOSS @Concat
                  last edited by

                  @Concat said in Background Music [Continued from Help/Support]:

                  I know this topic is huge, but Livewire's script is a year old. If you look you will see that @synack came up with a much simpler solution that will probably solve both of your issues. Retropie was updated not too long ago with support for runcommand-onstart and onend user scripts. Those scripts can be employed to turn off the music.

                  I'm not sure anyone is still tweaking Livewire's script.

                  Should probably be a new topic really, since it's very confusing to switch the discussion to a different method half way through.

                  Had no idea there was another method can you post a link to it please? Its a shame its not in an official build yet.

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

                    Looks for synack's original post in this topic.

                    1 Reply Last reply Reply Quote 0
                    • H
                      homerotl @synack
                      last edited by

                      @synack I just tried this and it worked great! Thank you!. One thing, the files runcommand-onstart.sh and runcommand-onend.sh did not exist on /opt/retropie/configs/all so I had to create them. For everyone else doing this, just remember to set chmod 755 on both files. Also, picked up some music from Minibosses to go with it.

                      jmvJ N 3 Replies Last reply Reply Quote 0
                      • T
                        tpacdc14
                        last edited by

                        Just curious, since someone said it above, your splash screen video can render over the top of the emulationstation loading screen?

                        I'm using the Carbon theme video splash screen and it transitions from that to the emulation station screen.
                        Is there any extra configuration I can do to have emulation station loading underneath my splash screen video?
                        My boot text is also off, if that helps.

                        1 Reply Last reply Reply Quote 0
                        • jmvJ
                          jmv @homerotl
                          last edited by

                          @homerotl I followed synack's instructions and created the files missing. I made sure they are set to chmod 755. The issue I have is the music is playing in the menu but it keeps playing when I launch and play a game. I'm on retropie 4.1.10

                          Raspberry Pi 3 Model B /Retropie 4.3.2

                          1 Reply Last reply Reply Quote 0
                          • jmvJ
                            jmv @homerotl
                            last edited by

                            @homerotl nevermind i followed instructions in another post he commented and i was missing the bgm.sh file

                            Raspberry Pi 3 Model B /Retropie 4.3.2

                            1 Reply Last reply Reply Quote 0
                            • GTR_BOSSG
                              GTR_BOSS
                              last edited by

                              The music also does not stop when playing Neo-Geo games with pifba even tho its in the .py script?!

                              C 1 Reply Last reply Reply Quote 0
                              • C
                                Concat @GTR_BOSS
                                last edited by

                                @GTR_BOSS said in Background Music [Continued from Help/Support]:

                                The music also does not stop when playing Neo-Geo games with pifba even tho its in the .py script?!

                                Are you still trying to get the original scripts to work??? Why not try Synack's method??

                                GTR_BOSSG 1 Reply Last reply Reply Quote 0
                                • GTR_BOSSG
                                  GTR_BOSS @Concat
                                  last edited by

                                  @Concat Thanks I am going to try and get the other method to work now. Can you please tell me how do I uninstall the first method completely?

                                  B 1 Reply Last reply Reply Quote 0
                                  • C
                                    Concat
                                    last edited by

                                    @GTR_BOSS
                                    Sorry, I never installed it, so I can't help.

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

                                      @GTR_BOSS
                                      I guess it depends on what you did originally to install it.

                                      I think all you need to is edit /etc/rc.local and remove this line from near the bottom:

                                      (sudo python /home/pi/PyScripts/Test1.py) &
                                      

                                      Then, if you want, you can delete /home/pi/PyScripts/Test1.py and then reboot your RPi.
                                      (if you called your .py file something else or put it in a different directory, just substitute as needed!)

                                      1 Reply Last reply Reply Quote 0
                                      • N
                                        Norkali @Livewire
                                        last edited by Norkali

                                        @synack - I went with the original script and have LXDE installed and can't figure out what I should add to the list of emulators to get the music to stop once I launch desktop from within EM. If I F4 out to terminal and enter 'startx' of course the music has already stopped at that point but I want to be able to have music stop playing when launch form within EM. Any suggestions? Thanks a ton.

                                        1 Reply Last reply Reply Quote 0
                                        • T
                                          TitQuentin
                                          last edited by

                                          Work perfectly ! Thx !!

                                          1 Reply Last reply Reply Quote 0
                                          • DarbyD
                                            Darby @synack
                                            last edited by

                                            @synack hey man!
                                            I'm stuck on getting this installed, I get the following:

                                            pi@retropie:~ $ sudo apt-get install mpg123
                                            Reading package lists... Done
                                            Building dependency tree
                                            Reading state information... Done
                                            The following extra packages will be installed:
                                            libltdl7
                                            Suggested packages:
                                            jackd nas oss-compat oss4-base pulseaudio
                                            The following NEW packages will be installed:
                                            libltdl7 mpg123
                                            0 upgraded, 2 newly installed, 0 to remove and 34 not upgraded.
                                            Need to get 152 kB/194 kB of archives.
                                            After this operation, 397 kB of additional disk space will be used.
                                            Do you want to continue? [Y/n] Y
                                            Err http://mirrordirector.raspbian.org/raspbian/ jessie/main mpg123 armhf 1.20.1-2
                                            404 Not Found [IP: 5.153.225.207 80]
                                            E: Failed to fetch http://mirrordirector.raspbian.org/raspbian/pool/main/m/mpg123/mpg123_1.20.1-2_armhf.deb 404 Not Found [IP: 5.153.225.207 80]

                                            E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

                                            Anyhelp will be appreciated!

                                            B S 2 Replies 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.