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 121.9k 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.
    • 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
            • B
              birthmarkered
              last edited by birthmarkered

              Hi, thanks for this! running great as expected. However is there a way I can hide the boot text?

              I already did this: https://retropie.org.uk/forum/topic/14299/tutorial-remove-boot-text-on-the-raspberry-pi-for-noobs

              But after installing the background music, there is a little boot text reappearing + the emulation station splash (which I also want to hide)

              If I can hide that my retropie is perfect!

              1 Reply Last reply Reply Quote 0
              • E
                Emerikant
                last edited by

                Just curious if anything has changed regarding whether it's possible to have different music per console screen? ie. Song 1 plays in ES, song 2 plays in Mame, song 3 plays in Nes, song 4 plays in Snes and so on and so on.

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

                  @Emerikant no this is not possible. If you want this feature you can use Recalbox or Batocera - there it is present. It is a part of Emulation Station and has barely nothing to do with the topic here.

                  E 1 Reply Last reply Reply Quote 0
                  • E
                    Emerikant @cyperghost
                    last edited by

                    @cyperghost Thanks, new to all this, just saw it mentioned earlier in this post but was so long ago wasn't sure if anything had changed.

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

                      Hi everyone, i made a simple installer to implement mpg123, plus options menu on RetroPie settings menu to change volume and turn music on/off.
                      Feel free to try it.
                      https://github.com/Naprosnia/RetroPie_BGM_Player

                      Tomorrow i will record a video to post on youtube, showing the installation steps and usage.

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

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

                        Hi everyone, i made a simple installer to implement mpg123, plus options menu on RetroPie settings menu to change volume and turn music on/off.
                        Feel free to try it.
                        https://github.com/Naprosnia/RetroPie_BGM_Player

                        Tomorrow i will record a video to post on youtube, showing the installation steps and usage.

                        Installation video:

                        cyperghostC 1 Reply Last reply Reply Quote 4
                        • cyperghostC
                          cyperghost @Naprosnia
                          last edited by cyperghost

                          @Naprosnia Nice video and really noob friendly
                          You are using tons of sudo commands and I would advise you to avoid the unneeded usage of these whenever possible. The idea with the volume is realy nice - sadly mpg123 does not support inline volume change.

                          You can take a look at my RetroPie Shares scripts here. Everything starting with BGM has something to do with mpg123 and background music. There is a realtime Volumefading and a Music Selection scripts available. The selection topic includes some hints discovered during coding phase.

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

                            @cyperghost Thanks for your feedback. Im rewriting all the code and applying your fade method (works like a charm, thanks), and add new settings (enable / disable fade; enable / disable "BGM stop" on emulator start [some people want their music playing while they play games] ). Now im using a settings file to save user choices, and reduce the number of files used, for a clear environment.
                            Im trying to finish this today.

                            If anyone has more ideas of new options that can be added please say.

                            cyperghostC 1 Reply Last reply Reply Quote 0
                            • WarC0zesW
                              WarC0zes
                              last edited by WarC0zes

                              @Naprosnia

                              Hi,
                              I install your script, but I don't have the Background Music Settings option on RetroPie settings menu.
                              Otherwise, how uninstalling your script.

                              My config:
                              pi3B
                              Retropie 4.4.7
                              Emulationstation 2.8.1rp

                              RetroPie v4.5.1 • RPi3 Model B • NorthPada 5V 3A • 128GB SanDisk Ultra Cat.10 microSDXC • 1 x Logitech Wireless Desktop MK250 • 1 x Qanba Q4RAF USB Arcade joysticks • 1 x PS4 Dualshock4 v2 controller • 1 x Mayflash Dolphinbar + Nintendo WiiMote.

                              N 1 Reply Last reply Reply Quote 0
                              • N
                                Naprosnia @WarC0zes
                                last edited by

                                Hello @WarC0zes, when RetroPie and EmulationStation loads, press F4 to access command line, then,
                                execute this code:

                                sudo ls RetroPie/retropiemenu/
                                
                                • next, a list of files will appear, check if there is one called "Background Music Settings.sh"
                                  • if yes, execute the following code to open Emulation Station again emulationstation press Enter
                                    • next, inside Emulation Station press the button ("start") to access Main Menu, go to "OTHER SETTINGS" and check if "PARSE GAMELISTS ONLY" is set to ON, if it is, please put it to OFF and restart your system, and check if the Background Music Settings appear.
                                  • If no, you can execute the following command on command line to disable BGM touch /home/pi/.bgmstop

                                Please leave some feedback.

                                1 Reply Last reply Reply Quote 0
                                • WarC0zesW
                                  WarC0zes
                                  last edited by

                                  @Naprosnia

                                  You have solved my problem, I had the option "PARSE GAMELISTS ONLY" set to ON.
                                  I put it to OFF and restart my system and I have the option now.
                                  Thanks

                                  sorry for my english.

                                  RetroPie v4.5.1 • RPi3 Model B • NorthPada 5V 3A • 128GB SanDisk Ultra Cat.10 microSDXC • 1 x Logitech Wireless Desktop MK250 • 1 x Qanba Q4RAF USB Arcade joysticks • 1 x PS4 Dualshock4 v2 controller • 1 x Mayflash Dolphinbar + Nintendo WiiMote.

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

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

                                    @cyperghost Thanks for your feedback. Im rewriting all the code and applying your fade method (works like a charm, thanks),

                                    You're welcome, please add the link to the original code into your modification if you make heavy use of these scripts.

                                    new settings (enable / disable fade; enable / disable "BGM stop" on emulator start [some people want their music playing while they play games] )

                                    I would avoid such settings. Therefore we have the User Menu from runcommand. There you can select to enable BGM again and with exit 2 you finsh runcommand and load your ROM. I think this makes more sense.

                                    Read here about the Runcommand menu

                                    sudo ls RetroPie/retropiemenu/

                                    There is really no need to execute scripts with root level. Your scripts need heavy code review to avoid right privilege errors.

                                    Then make the code more lightweight. If there is a action you are doing again and again then use functions and loops.
                                    A good example the the dowload of the config files -- Use an array with a loop
                                    Or the download of the example music use the expression {1..7} to count from 1 till 7

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

                                      Hello @cyperghost , has I said, I'm rewriting everything from scratch. I'm trying to follow some of your tip, such as reduce sudo a lot.
                                      I will certainly put your name and git link in the description of the scripts.

                                      cyperghostC 2 Replies Last reply Reply Quote 1
                                      • cyperghostC
                                        cyperghost @Naprosnia
                                        last edited by cyperghost

                                        @Naprosnia You are welcome
                                        I will comment on your github account.

                                        EDIT: Added my first comment as "issue"

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

                                          @Naprosnia Added annother "Issue" for code cleanup ;) the second regards the volume control. This is a real interesting feature ;)
                                          As long as your coding works for you it is okay. But look if you might change a path or a call you've to edit it 10x in your scripting. With my solution it's just one edit.
                                          Issue #2
                                          Issue #1

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

                                            New version released, now with fade effect , and possibility of listen your musics while playing games.
                                            Special thanks to @cyperghost for the fade script!

                                            Video:

                                            cyperghostC 1 Reply Last reply Reply Quote 2
                                            • 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.