RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    Quick and easy guide for adding music to Emulatonstation on RetroPie. Noob friendly!

    Scheduled Pinned Locked Moved General Discussion and Gaming
    musicbgmsynackguide
    165 Posts 59 Posters 112.4k 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.
    • Y
      Yuu
      last edited by

      @brigane I am facing a similar issue. If I have the background music enabled, all in-game sounds don't work. If disabled, no problems. I am using the 3.5 jack to get sound out. Was there ever a solution?

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

        @yuu not that I know of. I thought this would occur to other people as well but that doesn't seem to be the case.

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

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

          Perhaps something caused by the audio device selected?

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

            @zerojay yeah perhaps, but how will I know :)

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

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

              ...By changing the audio device selected?

              1 Reply Last reply Reply Quote 0
              • Y
                Yuu
                last edited by Yuu

                I've had it set on either Auto or 3.5, same result; if the background music is enabled, there will be no ingame music. I need to test this with HDMI.
                Edit: Tested with HDMI w/ HDMI Sound. This only effects the 3.5 jack output; HDMI with sound going to TV works fine.

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

                  @yuu thank you for clarifying that. Now, if only we knew how to make it work with 3.5mm or a USB sound card for that matter.

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

                  mituM 1 Reply Last reply Reply Quote 0
                  • mituM
                    mitu Global Moderator @Brigane
                    last edited by

                    @brigane As you noticed earlier, it could be because the 3.5 jack output is not able to play 2 simultaneous audio streams. The solution for this would be to use Dmix (https://alsa.opensrc.org/Dmix) or PulseAudio to do the sound mixing for such configurations.

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

                      @mitu thanks for the link. I would like to try and fix it, but I'm not quite sure how to do it. Linux isn't my strong side.

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

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

                        Hi I'm stuck on step 2 and 4..

                        step 2 causes this error on boot:

                        https://i.imgur.com/TD896Nk.jpg

                        The command must be outdated or something I dunno I copied it perfectly

                        And step 4 there is no retropie_welcome but above # RETROPIE PROFILE END in the /home/pi/.bashrc not at the end or anywhere?

                        Would love any help

                        Z 1 Reply Last reply Reply Quote 0
                        • Z
                          zerojay @steve51184
                          last edited by

                          @steve51184 said in Quick and easy guide for adding music to Emulatonstation on RetroPie. Noob friendly!:

                          Hi I'm stuck on step 2 and 4..

                          step 2 causes this error on boot:

                          https://i.imgur.com/TD896Nk.jpg

                          The command must be outdated or something I dunno I copied it perfectly

                          And step 4 there is no retropie_welcome but above # RETROPIE PROFILE END in the /home/pi/.bashrc not at the end or anywhere?

                          Would love any help

                          For step 2, it's not all meant to be on the same line. Everything after done needs to be on a second line.

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

                            @zerojay
                            Fixed both errors I should've updated the post ty though.. Any ideas in this: https://retropie.org.uk/forum/post/159736

                            1 Reply Last reply Reply Quote 0
                            • H
                              Hyuma
                              last edited by

                              this is awesome! @MapleStory there is a way to load playlist using some combo with joystick and buttons? I would like to have my playlist loaded only whit a combo or similar.. thanks!

                              1 Reply Last reply Reply Quote 0
                              • A
                                almulder @vj88
                                last edited by

                                @vj88 said in Quick and easy guide for adding music to Emulatonstation on RetroPie. Noob friendly!:

                                Hi everyone!!!
                                I have a problem with this... splash screen won't play over e.s. loading screen! Emulation always starts at splash screen end. I know that the problem is this method cause it doesn't wait without it!
                                Any help please?
                                Ps sorry for bad english
                                Thanks.

                                Has anyone figured this out? Is there a way to just start the audio even if the splash screen is still playing? I want BG music, but I also want the splash to play over the es logo.

                                1 Reply Last reply Reply Quote 0
                                • A
                                  almulder
                                  last edited by

                                  Ok I found a solution, needed to remove the fist line as that is a wait for the video to stop before it starts the next line. (Removed this line)

                                  while pgrep omxplayer >/dev/null; do sleep 1; done
                                  

                                  so in your autostart.sh have it look like this

                                  (sleep 10; mpg123 -Z /home/pi/RetroPie/backgroundmusic/*.mp3 >/dev/null 2>&1) & emulationstation #auto
                                  

                                  sleep controls the pause before it loads the music, so you can use that to make it so the music does not overlap with your video audio. The items inside the ( ) are done in the background so sleep has no effect on emulationstation starting.

                                  .
                                  Now here is what was odd. if you have --no-splash (See below) that would not work. I removed it so it would show splash and now my video plays over the top of it. I made the video long enough so I dont see the splash form ES and the music starts to play in the background about 3 seconds before my video finishes.

                                  (sleep 10; mpg123 -Z /home/pi/RetroPie/backgroundmusic/*.mp3 >/dev/null 2>&1) & emulationstation --no-splash #auto
                                  

                                  Hope this helps others!

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

                                    it would be nice if the retropie had the option to put sounds when selecting the system in the menu, as for example when choosing the snes played a super mario bgm, just as the recalbox has that option, I hope that in the future the retropie team think about this!

                                    1 Reply Last reply Reply Quote 0
                                    • P
                                      prog-amateur
                                      last edited by

                                      Hello, I try to get it working on my PC (Ubuntu 18.04) without success. Of course, I have replaced every /pi/ with /user/ because Retropie in Ubuntu doesn't have no /pi/ folder.

                                      Another thing which is strange is that I don't have omxplayer because it is not compatible with x86 CPUs. So shall I remove the line related to it ?

                                      I am sure, it is a matter of adjustment but I can't know what. I really would like to implement it, so please, feel free to help me.

                                      Thank you very much !

                                      cyperghostC 1 Reply Last reply Reply Quote 0
                                      • cyperghostC
                                        cyperghost @prog-amateur
                                        last edited by

                                        @prog-amateur Try replacing every /home/user with $HOME. This is a more general way

                                        1 Reply Last reply Reply Quote 0
                                        • P
                                          prog-amateur
                                          last edited by prog-amateur

                                          Thank you very much for your help. It didn't worked. I have applied it to

                                          • autostart.sh : (sleep 10; mpg123 -Z $HOME/bgm/*.mp3 >/dev/null 2>&1) &

                                          • .bashrc : sudo nano $HOME/.bashrc

                                          • and the music folder : mkdir $HOME/bgm

                                          By the way, something that I had to adjust was :

                                          • to remove the following line in autostart.sh because omxplayer is only compatible with ARM CPUs, not with x86 CPUs (so I was affraid about any error code) :
                                            while pgrep omxplayer >/dev/null; do sleep 1; done

                                          • in .bashrc, there was nothing called neither retropie_welcome nor # RETROPIE PROFILE END, so I have just pasted [[ $(tty) == "/dev/tty1" ]] && pkill mpg123 at the end of the document.

                                          Maybe I did something wrong ? I am sure it is a matter of small code, please feel free to help me (and other people as I have also seen my request asked by others but never answered). I am sure it can help, thank you so much for your kind help.

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

                                            Added fadein/fadeout feature for mpg123. You can read this thread for setup. I've tested the script for a few weeks and it seems to be stable.

                                            So instead of adding the pkill -CONT or -STOP mpg123 command to runcommand-onend.sh or runcommand-onstart.sh you add

                                            • runcommand-onstart.sh --> $HOME/scripts/BGM_vol_fade.sh -STOP
                                            • runcommand-onend.sh--> (sleep 2 && $HOME/scripts/BGM_vol_fade.sh -CONT) &

                                            If you don't use -STOP and -CONT switches then the script will toggle status itself. This will work in 99.99% of all cases to get 100% hitrate then use the force.

                                            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.