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 326.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.
    • Auz10A
      Auz10
      last edited by

      EXCELLENT METHOD, by far the best and most simplist so far. No errors anywhere either. My only issue is as stated previously when launching LXDE/Pixel from ES, music continues. Also when launching PPSSPP for PSP games, the music continues. Any advice sir? Any and all assistance will be highly appreciated!

      Some just re-image. Some actually look for the break in the code. I am somewhere between~

      BobHarrisB 1 Reply Last reply Reply Quote 0
      • BobHarrisB
        BobHarris @Auz10
        last edited by

        @auz10 You need to edit this file: bgmusic.py (located in /home/pi/PyScripts). In here add PPSSPPSDL to the list of emulators. Now the music will stop when you start PPSSPP.

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

        ByteThisB 1 Reply Last reply Reply Quote 0
        • ByteThisB
          ByteThis @BobHarris
          last edited by

          @bobharris Would you have a solution to kill the music when launching the Pixel Desktop (Chromium) ?

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

            Is there a particular reason you guys aren't using the runcommand-onstart and onend scripts to kill and restart the music without needing to add emulator names anywhere?

            ExarKunIvE 1 Reply Last reply Reply Quote 0
            • BobHarrisB
              BobHarris @ByteThis
              last edited by BobHarris

              @bytethis No sorry. I figured out the names of some emulators by starting an emulator, opening winscp on my pc, connecting to the pi, opening a terminal in winscp and typing: ps -A . This shows you the names of all the running programs. You could find out what name is used for the Pixel Desktop and add it to the emulator list (treating it as an emulator). But I have no idea if that even works. I can't think of any other solution, except trying a different route , like the method Zerojay is talking about.

              @zerojay There are some extra functionalities: Set a startsong, start a new song after exiting a game, music fade out when starting a game. When you add the missing emulators, it works just as well.

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

              ByteThisB 1 Reply Last reply Reply Quote 0
              • ByteThisB
                ByteThis @BobHarris
                last edited by

                @bobharris Ok..thanks ! I will play around with it and see what I can come up with.

                1 Reply Last reply Reply Quote 0
                • ExarKunIvE
                  ExarKunIv @zerojay
                  last edited by

                  @zerojay

                  i believe the other way that is posted here uses the runcommand to kill it, but it is way to sudden. some people like that way.
                  personally i like this way, yes it can be a pain to get the emulator to stop the music, but for me that is half the fun :)

                  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
                  • LexxL
                    Lexx
                    last edited by

                    Hey. I'm using the script from OP for a while now. Is there a way to mute and resume or start/stop it?
                    I can't figure out how :(

                    1 Reply Last reply Reply Quote 0
                    • RanmaR
                      Ranma
                      last edited by

                      Just wanted to add thanks for this method of adding music to the Pi. It works beautifully and has been glitch free for me so far. :-) Very easy to setup. Brilliant!

                      1 Reply Last reply Reply Quote 0
                      • madmodder123M
                        madmodder123
                        last edited by

                        I updated this script to add overlays of song titles when browsing ES
                        https://retropie.org.uk/forum/topic/16458/modfied-background-music-script-with-added-overlays
                        alt text

                        1 Reply Last reply Reply Quote 1
                        • M
                          m0riarty @jman
                          last edited by

                          This post is deleted!
                          1 Reply Last reply Reply Quote 0
                          • darkniorD
                            darknior
                            last edited by

                            I have try the script, and the other solutions and that never pause the music when OMXPlayer read a video.
                            Is there a solution ? i don't understand how to do it.
                            The music is only PAUSE when i launch an emulator.
                            Thanks

                            Life is game, just play it !

                            madmodder123M 1 Reply Last reply Reply Quote 0
                            • madmodder123M
                              madmodder123 @darknior
                              last edited by

                              @darknior emulatornames = ["retroarch","ags","uae4all2","uae4arm","capricerpi","linapple","hatari","stella","atari800","xroar","vice","daphne","reicast","pifba","osmose","gpsp","jzintv","basiliskll","mame","advmame","dgen","openmsx","mupen64plus","gngeo","dosbox","ppsspp","simcoupe","scummvm","snes9x","pisnes","frotz","fbzx","fuse","gemrb","cgenesis","zdoom","eduke32","lincity","love","kodi","alephone","micropolis","openbor","openttd","opentyrian","cannonball","tyrquake","ioquake3","residualvm","xrick","sdlpop","uqm","stratagus","wolf4sdl","solarus","drastic","coolcv","PPSSPPSDL","moonlight","Xorg","smw","omxplayer.bin"]

                              darkniorD 1 Reply Last reply Reply Quote 0
                              • darkniorD
                                darknior @madmodder123
                                last edited by darknior

                                @madmodder123 It works thanks a lot.
                                I don't have think the OMX must be in list too :p

                                I'm not using /etc/rc.local to launch it at start, autostart.sh is better i think :)

                                python /home/pi/retropie_bgm.py 2>&1 1>/dev/null &
                                emulationstation
                                

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

                                Delayed Start. Change startdelay to a value (in seconds) if you need the script to delay itself for some reason. At first this would have been for something like a video splash screen, but:

                                It's a delay to launch music at start.

                                But is it possible to add a delay to resume music every time the music is paused ?
                                because I can hear it between 2 videos, and many small stealthy moments like that where it should not.

                                I have try :

                                            #Turn up the music
                                            print "Emulator finished, resuming audio..."
                                            if not restart:
                                                time.sleep(5);
                                                mixer.music.unpause() #resume
                                

                                I think it's here but i'm not sure how to do it?
                                It work for the ES menu, the music come back after 5 sec, but some times i can always listen it between 2 videos and it don't take me more than 2 3 seconds to change game.
                                Thanks

                                Life is game, just play it !

                                darkniorD 1 Reply Last reply Reply Quote 0
                                • darkniorD
                                  darknior @darknior
                                  last edited by

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

                                  I'm not using /etc/rc.local to launch it at start, autostart.sh is better :)

                                  So stupid it's my bug, the & after emulationstation :(
                                  But rc.local not working for me.
                                  If some one can help for this too ?

                                  Life is game, just play it !

                                  1 Reply Last reply Reply Quote 0
                                  • W
                                    WayTooHip @Concat
                                    last edited by

                                    @concat I love your script, its what i used in my Pi, i just have a problem, when i enter into the in system terminal/command-line by pushing F4 on my keyboard the music stops as it is supposed but when i type "emulationstation" to get back to ES the music doesn't play anymore it completlely stops, everything else has sound just no background music, can you help me please? thanks in advance, i'm a noob just starting in this sort of things.

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

                                      Thanks!If u need cool sound effects , try this https://www.lucidsamples.com/free-sample-packs/181-free-sound-effects-sfx-pack.html

                                      1 Reply Last reply Reply Quote 0
                                      • M
                                        mubonassi @synack
                                        last edited by

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

                                        /opt/retropie/configs/all/autostart.sh

                                        Hello! Can I make the script start after EmulationStation is called? Because, making the script start after the EmulationStation is called is making my SplashScreen not surpass the EmulationStation screen anymore, I noticed that by deleting the line "while pgrep omxplayer >/dev/null; do sleep 1; done
                                        mpg123 -Z /home/pi/bgm/*.mp3 >/dev/null 2>&1 &" on the autostart.sh

                                        Can the script start after is called?

                                        1 Reply Last reply Reply Quote 0
                                        • W
                                          wcarvalho
                                          last edited by

                                          I'm doing some tests, I checked if I run the script more than once it plays the duplicate audio file, how do I fix it?

                                          1 Reply Last reply Reply Quote 0
                                          • matchamanM
                                            matchaman
                                            last edited by matchaman

                                            I'm trying to figure out how to make audio stop immediately once splashscreens for games (runcommand) appear instead of stopping when the emulator loads. Adding runcommand to emulatornames didn't help :/

                                            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.