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.
    • D
      dynaram
      last edited by

      Sorry but i have never wrote a script or know python or anything like that - this will be my first attempt to do it. but I was wondering about the muting of the sound while in emulation station.

      from what i read this.
      #Check to see if the DisableMusic file exists; if it does, stop doing everything!
      if os.path.exists('/home/pi/PyScripts/DisableMusic'):

      if i create this folder or file the music will stop.

      It sounds to me i have to ssh into the box to do this. (while in emulation station

      is there a way to say another script to be written that when pressing a specif keyboard key or joystick key to write the file to that location?

      and if another keyboard key or joystick key or maybe the same key, to remove the file?

      if using the same key: when key is press it checks - if file is there remove it. if not there added.

      Thank you

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

        One simple and stupid suggestion.

        Can you please add the version # to the top of the script.

        Thank you

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

          I finally installed the script and the music is working with no issues.

          I am trying to disable the music.

          But I cant get it to stop playing music.

          • I have change the time.sleep(15) to time.sleep(1) for testing purpose so i can test this within 1 minute
            I tested this via ssh while emulation station (es) is live and running and still there is sound (I tried this with DisableMusic as a file or folder same result

          • i also try this with file name or folder by creating them first - reboot and when the unit comes back up, there is still sound.

          this file or the folder has pi ownership but with a chmod of 644 I also tried with 777

          what could i be possibly doing wrong?

          what was the intended use of the pause sound?
          While in emulation station is running or only after boot?

          fellegF 1 Reply Last reply Reply Quote 0
          • fellegF
            felleg @dynaram
            last edited by

            @dynaram Not sure I entirely understand your issue, but I know that if you want to shut down the player, you can always use top from ssh to kill PyGames or mpg123 (depending on which one you're using).

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

              ok thank you. for the suggestion.

              What i am trying to accomplish is to mute the player while emulation station is on and i am navigating around.

              Sometimes the phone rings or someone rings the door bell. i want to be able to use the controller since is on my hand to mute the sound.

              i can always put the controller down and hit mute on the tv. :), but if i put the pi on a dedicated cabinet. I will not have that option if i use a computer monitor.

              I hope this helps understand what i am trying to do.

              fellegF 1 Reply Last reply Reply Quote 0
              • fellegF
                felleg @dynaram
                last edited by

                @dynaram Yeah, now I get it. Since the process is playing in the background and is independent of EmulationStation, I guess ES has no way of controlling the music right now and your best bet is just to mute the TV for the time being.

                D 1 Reply Last reply Reply Quote 0
                • D
                  dynaram @felleg
                  last edited by

                  @felleg thank you. that makes sense.

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

                    @synack Hey I'm really new to this and I'm actually making this whole thing as a gift for my girlfriend and I would love to put background music. I installed mpg123, and I assumed I just copied all of the other lines of code onto the command line and press enter. I know it's not that easy all the time though and I can't figure out how to get it to work. If you could possibly give me the rundown like i'm a toddler, or possibly do the world a HUGEEEEE service and upload a video tutorial of sorts for us not as skilled with linux and how it works. Anyway awaiting your response, thank you in advance!

                    synackS 1 Reply Last reply Reply Quote 1
                    • synackS
                      synack @Rao777
                      last edited by

                      @Rao777 Where I say "edit the file [...]", use the command "nano" to do so. While in nano, control-o saves the file, control-x exits. Besides that, it really is just copy/paste. If you have trouble, let me know where you're getting stuck and I'll try to help.

                      R HankolaH 3 Replies Last reply Reply Quote 0
                      • R
                        Rao777 @synack
                        last edited by

                        @synack Okay quick question where exactly do I place the "[[ $(tty) == "/dev/tty1" ]] && pkill mpg123" code in the bashrc

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

                          @synack Okay I just put it at the top, and just let it rock but I have a new question. I have Kodi as it's own directory as well as in ports. When I launch Kodi from ports, the music stops and the program functions as it should. When I have it run from the directory, it will still play the music and more or less bugs out the system. If I try to quit Kodi, it now keeps crashing and relaunching and Idk whats up or what to do. Any suggestions

                          synackS 1 Reply Last reply Reply Quote 0
                          • synackS
                            synack @Rao777
                            last edited by

                            @Rao777 you can execute pkill mpg123 before running Kodi manually, or just run it from within ES as you've already mentioned that it works using that method.

                            1 Reply Last reply Reply Quote 0
                            • BriganeB
                              Brigane
                              last edited by Brigane

                              I can't get the in-game sound to play when using @synack script. It says the soundcard is busy for some reason. Does anyone know how to fix this?
                              Edit: I'd like to add that I'm using a usb soundcard if that has anything to do with it.

                              Systems: Raspberry Pi 0/2/3 Model B+
                              Os: RetroPie 4.5
                              Frontend: Emulationstation & Attract Mode

                              synackS 1 Reply Last reply Reply Quote 0
                              • synackS
                                synack @Brigane
                                last edited by synack

                                @Brigane Using the USB sound card device is likely the reason. I'm curious, what advantage is there for using one?

                                Regardless, you can probably workaround the issue by doing the following instead of the original instructions in step 3 & 4:

                                1. edit /opt/retropie/configs/all/runcommand-onstart.sh
                                pkill mpg123
                                
                                1. edit /opt/retropie/configs/all/runcommand-onend.sh
                                mpg123 -Z /home/pi/bgm/*.mp3 >/dev/null 2>&1 &
                                
                                BriganeB 1 Reply Last reply Reply Quote 2
                                • BriganeB
                                  Brigane @synack
                                  last edited by

                                  @synack
                                  Works perfectly now. Thanks a bunch :)
                                  I'm currently experimenting with my Raspberry Pi Zero, and it doesn't have a soundcard integrated.

                                  Systems: Raspberry Pi 0/2/3 Model B+
                                  Os: RetroPie 4.5
                                  Frontend: Emulationstation & Attract Mode

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

                                    Nice Work m8 :)

                                    1 Reply Last reply Reply Quote 0
                                    • C
                                      Cisu02 @robertybob
                                      last edited by Cisu02

                                      Me too.

                                      1 Reply Last reply Reply Quote 0
                                      • S
                                        SaraSodaPop
                                        last edited by

                                        I'm having a hard time figuring out how to add the script file to my Pi. Is this something I should be doing outside the Pi? I'm really new to all this so I apologize if I misread something.

                                        S 1 Reply Last reply Reply Quote 0
                                        • S
                                          SaraSodaPop @SaraSodaPop
                                          last edited by

                                          @SaraSodaPop Oh whoops I didn't think Synack's post was a different method ha I decided to give that a try and oh wow it works so well! Nice work! Although there are some kinks I gotta mess with but I am very happy. :)

                                          1 Reply Last reply Reply Quote 1
                                          • G
                                            giventofly
                                            last edited by

                                            do the process names that check the process need to be equal or a wildcard is enough?

                                            "mame" matches advmame, mame2003, lr-mame, etc? if not, can i use mame or regular expressions?

                                            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.