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.7k 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.
    • 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
                  • D
                    DarishZone Banned
                    last edited by DarishZone

                    Hi, i have this script on my setting, came with Eazy Hax Tools, which can be upgraded, so i guess the script also be updated (?). I've only installed ogg files. I'm not obsessed on patterns, everything works fine, but seems to me player have some preference (?). I have over 150 tracks on sd card, but seems to play mostly the same tracks, guess the script play all tracks (not sure, but seems odd to think otherwise), but others on very minor percentage. It is my impression? There's a way to improve shuffle?

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

                      A great addition to my RetroPie. The only problem I've found is that the music won't stop for Wolfenstein 3D. I'm using Wolf4SDL, I can play the game but the script continues. I've looked at line 25 and "wolf4sdl" is already there. Has anyone else had the same problem or can suggest a fix?

                      Thank you!

                      T 1 Reply Last reply Reply Quote 0
                      • T
                        TigerMask @TigerMask
                        last edited by TigerMask

                        @tigermask

                        If anyone else if having the same problem, check this out:
                        https://github.com/retr0rangepi/RetrOrangePi/blob/master/Background_Music/bgmusic.py

                        I just copied the emulator list on line 25 across to my current code:
                        "wolf4sdl-3dr-v14", "wolf4sdl-gt-v14", "wolf4sdl-spear", "wolf4sdl-sw-v14", "xvic","xvic cart","xplus4","xpet","x128","x64sc","x64","PPSSPPSDL","prince","OpenBOR","Xorg","retroarch","ags","uae4all2","uae4arm","capricerpi","linapple","hatari","stella","atari800","xroar","vice","daphne.bin","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_run","mplayer"

                        Gonna play me some Wolfenstein 3D!

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

                          In the python script, why not just make the player adjust the volume down when it sees omxplayer running (while playing video snaps for example) instead of making it stop or pause the music and then resume every time?

                          Just have a couple basic configs like "normal volume" and "omx volume" so that people can tweak the settings to their preference. It seems like it would be much more simple, coding-wise, to just have the script look for any instance of omxplayer running and then adjust the music volume to whatever setting is specified. This could be instantaneous and not have to involve the fadeout parameter. Seems like it would run cleaner. I know that for my retropie build, the music player stopping and resuming all the time messes with my system previews (I lose video snaps in the systems and have to restart ES or go into and back out of an emulator to reset everything). EDIT: I was wrong, the stopping and starting wasn't the problem. I removed omx player from the list of emulator names so that it runs continuously even over the video snaps and I'm still having the same problem. Even so, it still seems like a cleaner way to set the player up.

                          Any skilled coders think they could reconfigure the python script in this way? Leave the emulator part the way it is, but change the omx player stuff to simply "when omx player is running, change the volume to 'x'"?

                          madmodder123M 1 Reply Last reply Reply Quote 0
                          • F
                            fdotg
                            last edited by fdotg

                            Does anyone know how to make the music stop when the screen saver starts? I have my screen saver set to black.

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

                              @fdotg No... this isn't possible. For VideoScreensaver it is possible with some scripts but not intended to be a good usecase.

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

                                @chad921s I might give it a shot when I have time.

                                I made a script that installs a modified version of this script which include overlays here!

                                1 Reply Last reply Reply Quote 0
                                • T
                                  tmak @anasazi29
                                  last edited by

                                  @anasazi29 Hi, I am having the same issue, all my emulators work for muting the music, except for PPSSPP. I have checked the music.py script and i see "ppsspp" listed but for some reason its not working. from your comment it sounds like you updated the emulator name in the script to "PPSSPPSDL" and that worked. Can you confirm. Also not being an expert on programming, is the script file case sensitive?
                                  Thanks,

                                  1 Reply Last reply Reply Quote 0
                                  • M
                                    michel30
                                    last edited by

                                    Hello,

                                    I run background music on my retropie raspberry pi 3 and when I start an emulation the music stop.

                                    I am using the py file music.py and the only emulator that does not stop the music is TI-99/4A I add in the music.py " ti99sim-sdl " but it does not stop when I start this emu.

                                    Hopefully somebody could help me why this is.

                                    Thanks,

                                    A 1 Reply Last reply Reply Quote 0
                                    • Z
                                      zerel
                                      last edited by

                                      I'm trying to install this on EmulationStation on Windows, can someone help me or it's only for Linux?

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

                                        @zerel It's only for Linux.

                                        1 Reply Last reply Reply Quote 0
                                        • J
                                          joelkolb
                                          last edited by

                                          I am running a freshly installed and fully up to date image of RetroPie and when I set up this script the music will not stop when I start a game. I'm using RetroArch for everything and line 25 of my script looks as it should with retroarch listed as the first item in emulatornames. I started over from a clean install once already just to make sure I didn't mess anything up. My gut is telling me it's something in a recent update to RetroPie that's causing this. Can anyone help?

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

                                            @joelkolb I prefer the mpg123 method. The python script uses an internal array to check running instances of an emulator and then stops music. The method above makes use of runcommand-onstart.sh and runcommand-onstop.sh which is more hands on.
                                            If you want fade in and fade out effect on the mpg123 you can use this scripts here.

                                            If you are eager in python coding you can release annother version that will get rid of this "libary" and uses also the runcommand options. That would be a more straight way. It's not a direct answer on your question I know.

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