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 346.8k 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.
    • HankolaH
      Hankola @Livewire
      last edited by

      @livewire
      Run "sudo nano /etc/rc.local"
      This file should have a bunch of commented stuff at the top, and "exit 0;" near the bottom. Above exit 0, put the following code, replacing the path with where you installed the script to earlier: "(sudo python /home/pi/PyScripts/Test1.py) &". For full disclosure, the & at the end runs the script in the background, which is necessary as it will run infinitely until the system shuts down.
      As before, press control+x, y, and enter to save changes.

      When I try to run this my file is empty. Can I simply type it in as it is written in other posts or videos?

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

        Here we can toggle/restart music via @synack method

        1 Reply Last reply Reply Quote 0
        • HankolaH
          Hankola @synack
          last edited by

          @synack I am having an issue of where I edit the bashrc. File...I mean where do I put the text info in this long line of stuff...and how do I save that?

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

            @hankola

            it cant be empty, if it is retropie will not run. you much be mistypeing something ( i do it all the time)

            just type sudo nano /etc/rc.local

            #
            # rc.local
            #
            # This script is executed at the end of each multiuser runlevel.
            # Make sure that the script will "exit 0" on success or any other
            # value on error.
            #
            # In order to enable or disable this script just change the execution
            # bits.
            #
            # By default this script does nothing.
            
            # Print the IP address
            _IP=$(hostname -I) || true
            if [ "$_IP" ]; then
              printf "My IP address is %s\n" "$_IP"
            fi
            
            sudo python /home/pi/scripts/fan.py &
            sudo python /home/pi/scripts/HID.py &
            
            sudo python /home/pi/scripts/shutdown.py &
            
            (sudo python /home/pi/scripts/BGmusic.py) &
            
            "/opt/retropie/supplementary/xboxdrv/bin/xboxdrv" --daemon --detach --dbus disabled --detach-kernel-driver --id 0 --led 2 --deadzone 4000 --silent --trigger-as-button
            exit 0
            

            this is mine. so as you can see there is a lot of stuff even before i add the line for muisc.

            to answer your other question. yes if you type
            sudo python /home/pi/PyScripts/Test1.py
            it will start the script

            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 1
            • ExarKunIvE
              ExarKunIv @Hankola
              last edited by

              @hankola

              your using livewire or synack method?

              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 .

              HankolaH 1 Reply Last reply Reply Quote 1
              • HankolaH
                Hankola @ExarKunIv
                last edited by

                @exarkuniv trying to use whichever will give me desired results. Which do you recommend?

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

                  @hankola

                  depends on how you feel doing the coding.

                  livewires give you more ability to edit the script.

                  synack is easier to set and go.

                  personally i use livewires i like how it fades the song better then it just ending

                  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 .

                  HankolaH 1 Reply Last reply Reply Quote 1
                  • HankolaH
                    Hankola @ExarKunIv
                    last edited by Hankola

                    @exarkuniv
                    depends on how you feel doing the coding.

                    livewires give you more ability to edit the script.

                    synack is easier to set and go.

                    personally i use livewires i like how it fades the song better then it just ending

                    Okay, I am super green. Synack method worked to start and stop the music great. But editing the bash file has me confused. When I follow his directions I do get a file, but it isn't like the other .sh files. There is not a command to save, nor any directions on where to add the file; I assume it's not a random placing.
                    So far I can undo everything by editing the .sh files...
                    I can't uninstall mpg123...no idea how, I would love the live wires method, but I have no idea how to get my .rclocal file to show up with something in it.

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

                      @hankola

                      since you have messed with synacks way look here

                      it is the same program, but i think it is explained better and smoother for people to follow.

                      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 .

                      HankolaH 1 Reply Last reply Reply Quote 1
                      • HankolaH
                        Hankola @ExarKunIv
                        last edited by

                        @exarkuniv
                        Okay, this worked for me. Does this method play randomly if I dump a bunch of mp3s into this folder?

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

                          @hankola
                          if you followed the link then no. it will start right where is ended. but if you edit the following then it will do random

                          To start a new set of tracks (upon game exit) instead of continuing from the last, you'd replace the original instructions do the following

                          edit /opt/retropie/configs/all/runcommand-onstart.sh

                          pkill mpg123
                          

                          edit /opt/retropie/configs/all/runcommand-onend.sh

                          mpg123 -Z /home/pi/bgm/*.mp3 >/dev/null 2>&1 &
                          

                          or if you wanted to keep logging the played tracks, you'd use this line instead in the runcommand-onend.sh script

                          mpg123 -Z /home/pi/bgm/*.mp3 2>>/dev/shm/playlist &
                          

                          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 .

                          HankolaH 1 Reply Last reply Reply Quote 1
                          • HankolaH
                            Hankola @ExarKunIv
                            last edited by

                            @exarkuniv all done. It is working great!

                            1 Reply Last reply Reply Quote 1
                            • N
                              Nayin @Nayin
                              last edited by

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

                              I am trying to add the amiberry emulator without success.
                              What is the exact name of "amiberry" to add in emulators line?
                              Thx!

                              Some help?

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

                                @nayin How is this issue related to the topic "Background Music"?

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

                                N 1 Reply Last reply Reply Quote 0
                                • N
                                  Nayin @Brigane
                                  last edited by

                                  @brigane

                                  Sorry, if I am not explained to me well.
                                  When I run amiberry emulator, the background music does not stop.

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

                                    @Nayin How do you play your BGM - via mpg123 = @synack method
                                    or via phyton script?

                                    The Amiberry emulator, how do you start it? Via runcommand.sh? Means you see they grey loading box if you select a ROM?

                                    1 Reply Last reply Reply Quote 0
                                    • N
                                      Nayin
                                      last edited by Nayin

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

                                      @Nayin How do you play your BGM - via mpg123 = @synack method
                                      or via phyton script?

                                      The Amiberry emulator, how do you start it? Via runcommand.sh? Means you see they grey loading box if you select a ROM?

                                      Via phyton script, I start the emulator using emulationstation (WHDLoad Pack).

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

                                        @nayin My first suggestion is to edit python script and add emulatorname to it
                                        line 25 in https://pastebin.com/7E9JiZGQ

                                        You can check if emulator is running via SSH and ps -a command to get correct name. The mpg123 is better imho as it relies on runcommand ...

                                        N 1 Reply Last reply Reply Quote 0
                                        • N
                                          Nayin @cyperghost
                                          last edited by

                                          @cyperghost

                                          Thx! The correct name is amiberry.sh

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

                                            That won't work as amiberry is a bash file.... start the emulator and use ps -a command to extract emuname it's 99% likely amiberry but not sure...

                                            You need the name of the binary... Maybe if you edit the amiberry.sh you see binary call and add the name to the python script

                                            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.