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 325.5k 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
      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
                              • Z
                                ZingZonZot @synack
                                last edited by

                                @synack
                                This is brilliant, I couldn't get Livewires to work at all but yours worked immediately I entered the code! I just can't figure out how to keep the music playing after reboot, I'm a bit of a noob to coding but I understand enough of it to know how what everything does.

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

                                  @ZingZonZot Glad to hear it. In regards to your problem, review the file /opt/retropie/configs/all/autostart.sh, make sure the mpg123 line comes before the emulationstation line.

                                  Z 1 Reply Last reply Reply Quote 0
                                  • Z
                                    ZingZonZot @synack
                                    last edited by

                                    @synack ok cool I got it working thanks! but can I delay the music somehow for a boot screen?

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

                                      @ZingZonZot in the same file (/opt/retropie/configs/all/autostart.sh), make sure the following line comes before the mpg123 line.

                                      while pgrep omxplayer >/dev/null; do sleep 1; done
                                      
                                      1 Reply Last reply Reply Quote 0
                                      • Z
                                        ZingZonZot
                                        last edited by

                                        yeah that's what I figured but wanted to be sure, I would set the do sleep xxx correct?

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

                                          @ZingZonZot You shouldn't need to change the sleep amount. That one-liner is checking every 1 second if the intro video is playing. As soon as it stops playing, it allows the next commands to be executed (the mp3 player and emulationstation)

                                          1 Reply Last reply Reply Quote 0
                                          • Z
                                            ZingZonZot
                                            last edited by

                                            ah ok, I'll get back to you if I have any problems with it when I install a custom boot screen since the music starts immediately as soon as the original ES splash screen starts up.

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