• Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login
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.
  • J
    jonnykesh @zerojay
    last edited by 27 Nov 2017, 00:12

    @zerojay How much room does it save? For example a track I use is 1:39 and 2.4MB. Would this really save a significant amount of space?

    Z 1 Reply Last reply 27 Nov 2017, 00:22 Reply Quote 0
    • Z
      zerojay @jonnykesh
      last edited by 27 Nov 2017, 00:22

      @jonnykesh Well, put it this way, if you have a full NES game's soundtrack, let's say 20 songs in mp3 for about 3MB each song, that's 60MB. The emulated version is going to be a small part of the actual NES game's size so there's pretty much no NES game soundtrack in VGM format that will be bigger than 1MB total. Most NES games are about 200-300K for their full soundtrack in this format. Look around for VGM rips as they are a better indicator than anything I can say.

      1 Reply Last reply Reply Quote 0
      • B
        BobHarris
        last edited by BobHarris 22 Dec 2017, 00:55

        Could somebody tell me which file I have to edit (and what kind of text) to set a startsong which plays everytime when you boot up the Pi?

        Pi 3B , 64 GB Sandisk ultra flashdrive, 19 systems, 872 hand picked classic gaming gems :-) Dual shock 4v2

        M 1 Reply Last reply 23 Dec 2017, 16:13 Reply Quote 0
        • C
          coldnpale
          last edited by 23 Dec 2017, 14:15

          Great guide! Anyway to choose what track plays first if we have many mp3's in the folder?

          1 Reply Last reply Reply Quote 0
          • M
            mitu Global Moderator @BobHarris
            last edited by mitu 23 Dec 2017, 16:13

            @bobharris Since the command line using mpg321 plays the songs at random, there's no configuration involved.
            You could try replacing mpg321 -Z with mpg321 -l 0 (lowecase L, then zero) in the playing script and the playorder should be alphabetical - so you can place a 0_start.mpg3 to be always played first.

            B 2 Replies Last reply 23 Dec 2017, 16:28 Reply Quote 2
            • B
              BobHarris @mitu
              last edited by BobHarris 23 Dec 2017, 16:28

              @mitu Ok thanks. This is not an option for me, as I prefer a randomized playlist after the first song.
              So I will just use the Python script instead (http://www.pretendo.online/2017/01/25/adding-background-music-to-emulation-station/).. so far it seems to work great (and it allows you to set a startsong). It has other perks too, like fade out (after starting a game) and it plays a new song after exiting a game, instead of resuming the previous song.
              I wasn't sure which method to use as I read some people were having issues with the Python script. (Songs playing at half speed for example.)

              (There is a workaround for anyone who uses mpg123 and wants the same song/sound at the start and a random playlist: Turn your song into an mp4 video file and set it as your splash screen.)

              Pi 3B , 64 GB Sandisk ultra flashdrive, 19 systems, 872 hand picked classic gaming gems :-) Dual shock 4v2

              C 1 Reply Last reply 23 Dec 2017, 17:22 Reply Quote 1
              • C
                coldnpale @BobHarris
                last edited by coldnpale 23 Dec 2017, 17:22

                @mitu
                amazing! thanks alot!

                1 Reply Last reply Reply Quote 0
                • C
                  coldnpale
                  last edited by 23 Dec 2017, 21:44

                  So, now with "mpg321 -l 0" I am able to arrange the songs in the order I want. Tha's great! However, isn't the playlist supposed to loop infinite times after it ends? Or am I missing a part?

                  M 1 Reply Last reply 23 Dec 2017, 21:50 Reply Quote 0
                  • M
                    mitu Global Moderator @coldnpale
                    last edited by mitu 23 Dec 2017, 21:50

                    @coldnpale Err', I guess it only loops through the 1st song, right ? So my suggestion doesn't work right off the bat :(.
                    I don't have the RPI at hand at the moment, but you could create a .m3u with the files you want, in the specific order you need, then try to run

                    mpg321 -l -0 playlist.m3u
                    

                    so it loops continuously. I'm sure there's a one liner to make the m3u on the fly, but just need a command line on the PI to have it right.

                    1 Reply Last reply Reply Quote 1
                    • C
                      coldnpale
                      last edited by coldnpale 23 Dec 2017, 21:55

                      @mitu
                      Thanks!
                      At the moment i am using 2 songs to test it, withou an .m3u. It plays them in alphabetical order, but once the second song finishes nothing starts again.
                      But I could always try an .m3u ..i'll give it a shot

                      M 1 Reply Last reply 26 Dec 2017, 06:07 Reply Quote 1
                      • B
                        BobHarris @mitu
                        last edited by BobHarris 25 Dec 2017, 23:22

                        @mitu This change in the script (-l 0 instead of -Z) is actually very helpful.
                        I now have another build with no music in the bgm folder except for the Sony ps1 bootup sound. With this script you hear it only once when booting and then it's all quiet. :-)
                        It might become my new main build if I get tired of my playlist.

                        Pi 3B , 64 GB Sandisk ultra flashdrive, 19 systems, 872 hand picked classic gaming gems :-) Dual shock 4v2

                        M 1 Reply Last reply 26 Dec 2017, 06:09 Reply Quote 0
                        • M
                          mitu Global Moderator @coldnpale
                          last edited by 26 Dec 2017, 06:07

                          @coldnpale Ok, I got to run a test and this is what seems to work:

                          1. Make a .m3u file with the names/paths of the mp3 files:
                          /home/pi/music/file_start.mp3
                          /home/pi/music/file2.mp3
                          /home/pi/music/file3.mp3
                          ...
                          
                          1. Run mpg321 with:
                          mpg321 -l 0 -@ path_to_m3u_file
                          

                          replacing path_to_m3u_filewith the actual path of the m3u file.

                          C 1 Reply Last reply 26 Dec 2017, 09:44 Reply Quote 1
                          • M
                            mitu Global Moderator @BobHarris
                            last edited by 26 Dec 2017, 06:09

                            @bobharris If you only have 1 file, then just running mpg321 /path/to/mp3file would be enough, i.e. no parameters would be needed.

                            B 1 Reply Last reply 26 Dec 2017, 09:43 Reply Quote 2
                            • B
                              BobHarris @mitu
                              last edited by 26 Dec 2017, 09:43

                              @mitu Ok thanks!

                              Pi 3B , 64 GB Sandisk ultra flashdrive, 19 systems, 872 hand picked classic gaming gems :-) Dual shock 4v2

                              1 Reply Last reply Reply Quote 0
                              • C
                                coldnpale @mitu
                                last edited by 26 Dec 2017, 09:44

                                @mitu thanks a lot! I'll check this as soon as I am back home!

                                1 Reply Last reply Reply Quote 0
                                • F
                                  Finnbro
                                  last edited by 4 Feb 2018, 19:06

                                  I have a couple questions involving this bgm method, would be interested if anyone has any input.

                                  1. I've been wanting to modify this where it starts a new song after exiting a game, instead of resuming the same song. My current fix was to edit the /opt/retropie/configs/all/runcommand-onend.sh to be the exact same as the autostart.sh in the same folder. This effectively reloads RetroPie every time I exit a game, and while it does give me the intended effect of playing a new song, it is a bit inconvenient with the extra loading time and not resuming from the same place I was in the games menu. Anyone know of a more elegant method?

                                  2. Does anyone know of a script where you can have a button that sets a different folder for bgm music, as well as some kind of skip button? I have the on/off button enabled in my RetroPie menu thanks to /u/columboscoat over on /r/RetroPie, but these extra options would be fantastic additions to my build. I have a folder for chiptunes and a folder for remixes, would be awesome to be able to switch them on the fly. I've done some research on the ins and outs of mpg123, but it is way over my head.

                                  Thanks in advance.

                                  cyperghostC 1 Reply Last reply 4 Feb 2018, 19:17 Reply Quote 0
                                  • cyperghostC
                                    cyperghost @Finnbro
                                    last edited by cyperghost 2 Apr 2018, 19:18 4 Feb 2018, 19:17

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

                                    I've been wanting to modify this where it starts a new song after exiting a game, instead of resuming the same song. My current fix was to edit the /opt/retropie/configs/all/runcommand-onend.sh to be the exact same as the autostart.sh in the same folder. This effectively reloads RetroPie every time I exit a game, and while it does give me the intended effect of playing a new song, it is a bit inconvenient with the extra loading time and not resuming from the same place I was in the games menu. Anyone know of a more elegant method?

                                    That easy to do.
                                    modify /opt/retropie/configs/all/runcommand-onstart.sh with pkill mpg123 > /dev/null 2>&1
                                    This terminates mpg123 if you start a ROM

                                    modify /opt/retropie/configs/all/runcommand-onend.sh with mpg123 -Z /media/usb0/BGM/*.mp3 > /dev/null 2>&1 &
                                    The /media/usb... thing represents the path were the mp3 are deployed

                                    Does anyone know of a script where you can have a button that sets a different folder for bgm music, as well as some kind of skip button? I have the on/off button enabled in my RetroPie menu thanks to /u/columboscoat over on /r/RetroPie, but these extra options would be fantastic additions to my build. I have a folder for chiptunes and a folder for remixes, would be awesome to be able to switch them on the fly. I've done some research on the ins and outs of mpg123, but it is way over my head.

                                    Als no problem. Trigger a GPIO event that terminates mpg123 and restarts it with annother folder path. That's a kind of "SKIP" function.
                                    Sadly mpg123 is a bit limited with controls but it's enough imho for a BGM player.

                                    F 1 Reply Last reply 4 Feb 2018, 19:18 Reply Quote 1
                                    • F
                                      Finnbro @cyperghost
                                      last edited by 4 Feb 2018, 19:18

                                      @cyperghost Thank you so much for the quick response! I will try this stuff and report back if I need further assistance.

                                      1 Reply Last reply Reply Quote 0
                                      • V
                                        vj88
                                        last edited by 10 Feb 2018, 10:38

                                        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.

                                        C A 2 Replies Last reply 13 Feb 2018, 11:02 Reply Quote 0
                                        • C
                                          coldnpale
                                          last edited by 10 Feb 2018, 12:19

                                          It happens for me also like that.. I thought it was supposed to be like this. It's not a big issue but would be nice to save some more time.

                                          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.

                                            [[user:consent.lead]]
                                            [[user:consent.not_received]]