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 324.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.
    • R
      retronerd @backstander
      last edited by

      @backstander ive tried the alternative script but i got this error?
      0_1486137456294_ppp.png

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

        @retronerd
        Try this first:
        sudo apt-get update

        Then try:
        sudo apt-get install mpg123

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

          its seems to download:)
          how do i edit /opt/retropie/configs/all/autostart.sh which command?

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

            @retronerd

            how do i edit /opt/retropie/configs/all/autostart.sh which command?

            Most of us use that program "nano" to edit files from the command line. Examples below!

            step 2:
            nano /opt/retropie/configs/all/autostart.sh

            step 3:
            nano /opt/retropie/configs/all/runcommand-onstart.sh

            step 4:
            nano /opt/retropie/configs/all/runcommand-onend.sh

            step 5:
            nano /home/pi/.bashrc

            If any of those won't let you save your changes, then add sudo before the nano like sudo nano blah blah blah...

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

              Thanks! but where shall i put [[ $(tty) == "/dev/tty1" ]] && pkill mpg123 in last step?
              where shall i put my music?
              in step 2: shall i put it the row under emulationstation #auto?

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

                @retronerd

                but where shall i put [[ $(tty) == "/dev/tty1" ]] && pkill mpg123 in last step?

                inside the file /home/pi/.bashrc
                or nano /home/pi/.bashrc

                where shall i put my music?

                In a folder named /home/pi/bgm/

                "bgm" stands for Back Ground Music ;-)

                in step 2: shall i put it the row under emulationstation #auto?

                I believe so.

                R 1 Reply Last reply Reply Quote 0
                • R
                  retronerd @backstander
                  last edited by

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

                  inside the file /home/pi/.bashrc

                  i mean under wish line in the file?

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

                    @retronerd

                    in step 2: shall i put it the row under emulationstation #auto?

                    Correction! you put that before emulationstation #auto like this:

                    while pgrep omxplayer >/dev/null; do sleep 1; done
                    mpg123 -Z /home/pi/bgm/*.mp3 >/dev/null 2>&1 &
                    emulationstation #auto
                    

                    inside the file /home/pi/.bashrc
                    i mean under wish line in the file?

                    I just put it at the very end of that file and it worked for me.

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

                      everything is working ecept the music is still playing if i quit emualationstation.
                      thats why i dont know where to put
                      [[ $(tty) == "/dev/tty1" ]] && pkill mpg123 Before which line?

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

                        @retronerd
                        I just put mine at the very end and it works for me.

                        Here is what the very bottom of my /home/pi/.bashrc looks like:

                        retropie_welcome
                        # RETROPIE PROFILE END
                        [[ $(tty) == "/dev/tty1" ]] && pkill mpg123
                        
                        1 Reply Last reply Reply Quote 0
                        • R
                          retronerd
                          last edited by

                          @backstander Thanks for everything works great:)

                          1 Reply Last reply Reply Quote 1
                          • L
                            LiqwdE
                            last edited by

                            Needs help ladies and gents, works great. But noticed it doesn't cut out when I run daphne roms 😣

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

                              Is there an easy way to modify one of these scripts so the audio plays on boot? I don't want to make all the splash screens I use into videos (I have them on random)

                              I was thinking of having the dial up modem sound play upon booting, can someone please help me? :)

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

                                @madmodder123 So I tried just adding "mpg123 -q insert mp3 here" above emulationstation #auto in the autostart.sh file, but there was still a delay for when the sound actually started playing and it still displayed the console for a little bit before loading ES (I have it hidden by default)

                                Is there another file I can edit to make it play the file right after it boots? (right after mounting the SD card preferably)

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

                                  @madmodder123
                                  You might try just putting mpg123 -q <dial-up-modem>.mp3 & at the very bottom of /etc/rc.local just above the last line exit 0. This should only play that dial up modem sound when you boot your RPi. Then you could still play other random MP3s by using /home/pi/.bashrc.

                                  If that isn't soon enough, you might experiment with putting that mpg123 line up higher in /etc/rc.local but make sure to make a back up of that file just in case!

                                  * 2 Replies Last reply Reply Quote 0
                                  • J
                                    jerryb1 @Livewire
                                    last edited by

                                    @Livewire I was looking into background music, but I wanted a way to have retropie as media player while playing games at the same. So for instance imagine playing MAME with only sound effects from the game, but no gaming music. Instead you hear your mp3 while game on.

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

                                      @jerryb1

                                      Instead you hear your mp3 while game on.

                                      You could follow steps 1 and 2 of @synack alternative background music script (leave out steps 3, 4 and 5):
                                      https://retropie.org.uk/forum/topic/347/background-music-continued-from-help-support/43

                                      This will make it continually play random MP3s from the /home/pi/bgm/ directory...even when you're playing games.

                                      Recap of the directions (steps 1 and 2):

                                      1. Install mpg123

                                      sudo apt-get install mpg123

                                      1. Edit /opt/retropie/configs/all/autostart.sh and add this before EmulationStation is called;

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

                                      while pgrep omxplayer >/dev/null; do sleep 1; done
                                      mpg123 -Z /home/pi/bgm/*.mp3 >/dev/null 2>&1 &
                                      emulationstation #auto
                                      
                                      1 Reply Last reply Reply Quote 0
                                      • K
                                        Kristopherson05
                                        last edited by

                                        Hey I was wondering if there's a way to skip a song or turn off the music (at a push of a button). It's not too important but would be great if I could. BTW, for some reason it doesn't play the full repertoire of songs and the script picks favorites, can I fix this somehow? Thanks

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

                                          I have noticed that in FBA for example the in game music stops for a second and after that resumes in random games... Ive tried to unistall theBGM but its still there? anyone

                                          1 Reply Last reply Reply Quote 0
                                          • L
                                            Linkseo
                                            last edited by

                                            Hello and Thank you for the script its great.
                                            Just a little help though. It still plays while launching daphne and Nintendo DS emulator. I checked the script and saw that daphne was on there with the others and I added Nintendo DS but music still plays over those 2.
                                            Sorry in advance if this issue has been resolved in this thread and I missed it. I skimmed through the entire thing but didn't see it.
                                            Thanks

                                            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.