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.1k 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.
    • 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
          • B
            backstander @Darby
            last edited by

            @Darby
            Try sudo apt-get update then try sudo apt-get install mpg123 again

            1 Reply Last reply Reply Quote 0
            • N
              N0va @homerotl
              last edited by

              @homerotl Hey hoping you could help I had the same issue with the files not being there, I got music working in the main menu it just does not stop and play again when existing emulators. Care to share in a little more detail how you got the files to work?

              1 Reply Last reply Reply Quote 0
              • N
                N0va @synack
                last edited by

                @synack Hey man I am having some trouble here. I got the music playing at the home screen but when I enter a game the music does not stop. When I first did this I noticed there was no runcommand-onstart.sh and runcommand-onend.sh I had to create them. I think this is the problem any suggestions?? Any help would be appreciated.

                (Also side note not as important, any way to decrease volume of music without decrease monitor volume?)

                1 Reply Last reply Reply Quote 0
                • B
                  belze @synack
                  last edited by

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

                  @retrobean Not to derail the thread or take away from @Livewire's contribution here, but you can also just use an external mp3 player such as mpg123 to play music without worrying about details.

                  1. install mpg123
                  sudo apt-get install mpg123
                  
                  1. edit /opt/retropie/configs/all/autostart.sh and before emulationstation is called;
                  while pgrep omxplayer >/dev/null; do sleep 1; done
                  mpg123 -Z /home/pi/bgm/*.mp3 >/dev/null 2>&1 &
                  
                  1. edit /opt/retropie/configs/all/runcommand-onstart.sh
                  pkill -STOP mpg123
                  
                  1. edit /opt/retropie/configs/all/runcommand-onend.sh
                  pkill -CONT mpg123
                  
                  1. edit /home/pi/.bashrc and add
                  [[ $(tty) == "/dev/tty1" ]] && pkill mpg123
                  

                  This will randomly play mp3s from the specified folder (step 2), pause the player upon entering a game, resume when exiting, and also stop the player when exiting emulationstation and dropping to a bash shell.

                  I'm following this method but I have an issue on autostart.sh incorrect syntax on line 4. This is how I have set up autostart.sh:

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

                  I don't get it where I wrong, the synack's code is before the emulationstation and there isn't a line 4!

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

                    Cant get it to work? here is my settings.
                    0_1485981480761_IMG_1811.JPG 0_1485981491389_IMG_1812.JPG 0_1485981499113_IMG_1813.JPG

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

                      @retronerd
                      It looks like in your 1st picture of /etc/rc.local you are trying to execute /home/pi/PyScripts/Test1.py but
                      in the 2nd picture (unless I'm mistaken) is of ???/pi/.config/PyScripts/Test1.py

                      The 3rd picture I can't tell if it is correct unless I see what's inside your Test1.py

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

                        ive changed the folder Scripts to PI/Scripts but it doesnt work:(?

                        i havent changed anything in the script so the music folder shall be in roms right?

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

                          @retronerd

                          ive changed the folder Scripts to PI/Scripts but it doesnt work:(?

                          The other thing I would check is if that Script is executable. Run this to make it executable:
                          chmod +x /home/pi/PyScripts/Test1.py

                          If it already was executable running this will not harm anything.

                          i havent changed anything in the script so the music folder shall be in roms right?

                          Yes @Livewire's script uses /home/pi/RetroPie/roms/music/ for the Music directory

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

                            Thanks but that doesnt solve my problem????

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

                              @retronerd
                              Oh, make sure in /etc/rc.local that (sudo python /home/pi/PyScripts/Test1.py) & is all on one single line.

                              Your 1st picture shows it on 2 lines.

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

                                ive changed to 1 line but doesnt work

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

                                  @retronerd

                                  ive changed to 1 line but doesnt work

                                  Hmmm....just to verify, did you run sudo apt-get install python-pygame

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

                                    @backstander yes what im doing wrong?
                                    0_1485991500169_eeee.jpg
                                    look at the S on script is that right? its from 1 page here

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

                                      0_1486037212864_fff.png

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

                                        @retronerd

                                        what im doing wrong?

                                        Hmmm...I'm kind of stumped right now.

                                        look at the S on script is that right? its from 1 page here

                                        That uppercase 'S' is correct in /home/pi/PyScripts/Test1.py

                                        Your picture of the Test1.py looks correct as well.

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

                                          @backstander thats strange! ?????

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

                                            @backstander
                                            can i unistall this and install it again somehow?

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