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 338.2k 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.
    • ExarKunIvE
      ExarKunIv
      last edited by

      Just wanted to say i love the BGmusic. works great every time and easy to tweak if need be

      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 0
      • M
        manser87
        last edited by

        Oh boy... this sounds complicated. I was hoping for something a little more "pre packaged" lol. Setting up my raspberry pi with retropie and all my roms was a fun project but i also had google and some great youtube videos holding my hand in the process. Adding music to my pi would be the finishing touch to something i get excited to share with my friends everytime they come over. Ill try my best to wrap my head around this with my university of google.com education. I still hope for someone to simplify this as much as possible. I think a song selection in the emulationstation menu would be a great addition. Much like there is a theme selection built in.

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

          @manser87

          for the most part it is,

          he does a very good job of explaining what you have to do and how.
          Once you get a better handle on how to edit some of the files. this will be easy for you.

          it threw me for a loop for a min when the music did not cut for of the Emulators, but then looked and found where i needed to add it

          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 0
          • BriganeB
            Brigane
            last edited by Brigane

            @Livewire Works like a charm, except that it doesn't change to the ingame music when entering a game. The music stops and I have total silence :(

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

            1 Reply Last reply Reply Quote 0
            • fellegF
              felleg
              last edited by

              One strange thing is happening to me. For very specific songs, they are played at half speed for whatever reason. These songs include all music I tested from the Mario Kart 8 soundtrack, and the Melee 2 theme from Smash Bros for Wii U. I tried opening the song in Audacity and re-exporting them as mp3/ogg, and both attempts changed nothing.

              Anyone has an idea what is going on?

              ExarKunIvE 1 Reply Last reply Reply Quote 0
              • M
                manser87
                last edited by

                I did it!!! I'm so freaking excited! Thanks for this!

                1 Reply Last reply Reply Quote 0
                • _Who_Was_Phone__
                  _Who_Was_Phone_
                  last edited by _Who_Was_Phone_

                  I've added "smw","supertux","cavestory" to my emulatornames= line, but only Cave Story is recognized. I suspect it's because it's a Retroarch core (lr-nxengine), rather than a standalone binary.

                  Do I have the wrong process names for Super Mario War and Super Tux?

                  Edit: I had everything right, I just needed to restart the Pi.

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

                    @felleg dont know if this will fix it, but does any of the song have anything in the ID3 tags? if they do they clear them out.

                    i had a problem with the Doom port seeing my MP3s before i cleared all the tag info.

                    i dont know if it will help or not, just a thought

                    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 .

                    fellegF 1 Reply Last reply Reply Quote 0
                    • fellegF
                      felleg @ExarKunIv
                      last edited by

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

                      @felleg dont know if this will fix it, but does any of the song have anything in the ID3 tags? if they do they clear them out.

                      i had a problem with the Doom port seeing my MP3s before i cleared all the tag info.

                      i dont know if it will help or not, just a thought

                      It's worth a shot, I'll try it out and edit this post with the result when I get home.

                      1 Reply Last reply Reply Quote 0
                      • retrobeanR
                        retrobean
                        last edited by

                        I can confirm that this code works like a charm!

                        The only thing I would mention, being a new Raspberry Pi user, is that i had no idea how to create the .py file. It turned out that I needed to download python and pygame for PC, copy the text script in, and then save the file, then move it to the pi and make sure it was in the correct folder! ugh!. Good fun though.

                        Big shout to livewire for making this. I too, though am having the same issue with some MP3's playing at half speed, any fix for this would be great.

                        All in all, fantastic to have background music on my retropie.

                        Ra

                        1 Reply Last reply Reply Quote 0
                        • J
                          josete2k
                          last edited by josete2k

                          Great work!!!!!

                          Sometimes the music is still playing when a game is already running.

                          I've tested lr-mame2003 with arkanoid and the music stops in the check ram screen...

                          I have launching.png screen too...

                          How can I stop it sooner? I'm changing values in the volumefadespeed (from 0.02 to 6.0) and sometimes there is a little difference.

                          Thanks again.

                          1 Reply Last reply Reply Quote 0
                          • retrobeanR
                            retrobean
                            last edited by

                            I think i may have figured out why some mp3 files will play at slower speed.

                            When the PyGame mixer is intialized using the default settings

                            pygame.mixer.init()
                            initialize the mixer module
                            init(frequency=22050, size=-16, channels=2, buffer=4096) -> None

                            So i suppose the mp3 files HAVE to be this format to play correctly, now i downloaded most of the music I am using and some files play at the correct speed and some play slower, so what I will do tonight is look at the information of the files and check to make sure they are the same.

                            Once i have checked this I will update.

                            Would anyone be able to conifrm or deny if this could make a difference?

                            Thanks

                            fellegF synackS 2 Replies Last reply Reply Quote 0
                            • fellegF
                              felleg @retrobean
                              last edited by

                              @retrobean Nice find! I'm excited to see the results :)

                              retrobeanR 1 Reply Last reply Reply Quote 0
                              • retrobeanR
                                retrobean @felleg
                                last edited by

                                @felleg I shall report back when i've had a chance to look into it :D

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

                                  @retrobean Not to derail the thread or take away from @Livewire's contribution here, but you can also just use an external mp3 player such as mpg123 to play music without worrying about details.

                                  1. install mpg123
                                  sudo apt-get install mpg123
                                  
                                  1. edit /opt/retropie/configs/all/autostart.sh and before emulationstation is called;
                                  while pgrep omxplayer >/dev/null; do sleep 1; done
                                  mpg123 -Z /home/pi/bgm/*.mp3 >/dev/null 2>&1 &
                                  
                                  1. edit /opt/retropie/configs/all/runcommand-onstart.sh
                                  pkill -STOP mpg123
                                  
                                  1. edit /opt/retropie/configs/all/runcommand-onend.sh
                                  pkill -CONT mpg123
                                  
                                  1. edit /home/pi/.bashrc and add
                                  [[ $(tty) == "/dev/tty1" ]] && pkill mpg123
                                  

                                  This will randomly play mp3s from the specified folder (step 2), pause the player upon entering a game, resume when exiting, and also stop the player when exiting emulationstation and dropping to a bash shell.

                                  retrobeanR R Z K H 13 Replies Last reply Reply Quote 11
                                  • retrobeanR
                                    retrobean @synack
                                    last edited by

                                    @synack nice! this looks like its worth doing.

                                    Thanks.

                                    1 Reply Last reply Reply Quote 0
                                    • retrobeanR
                                      retrobean @synack
                                      last edited by

                                      @synack

                                      just added the code in now! fantastic works well first time.

                                      Thanks for that.

                                      Emulatiosstation with bgm is go go go!!

                                      1 Reply Last reply Reply Quote 0
                                      • J
                                        josete2k
                                        last edited by

                                        Does mpg123 also work with ogg files?

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

                                          @josete2k no, but ogg123 does. It's available in the vorbis-tools package.

                                          sudo apt-get install vorbis-tools
                                          
                                          J 1 Reply Last reply Reply Quote 0
                                          • J
                                            j.e.f.f
                                            last edited by

                                            Script is working for me -- Thanks for this!

                                            I'm having one small issue where the music isn't fading out out properly when I start a game. I just cuts right out. If I set the fade delay to something really slow, the music comes back in partially faded after a couple of seconds and completes the fade out. So fade out is working but it is momentarily muted during the fade. Any ideas? If it helps, I'm using an MP3. I know you said there might be issues with MP3's... is this what you meant? Other than the fade problem, playback is fine.

                                            Thanks!

                                            • Jeff
                                            retrobeanR 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.