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

    Integrated Music Player for RetroPie [IMP] 2021.10 (Background Music for RetroPie and More)

    Scheduled Pinned Locked Moved Projects and Themes
    backgroundmusicretropiempg123 bgmimp
    158 Posts 20 Posters 50.3k 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.
    • RapidEdwin08R
      RapidEdwin08 @smartgenes
      last edited by RapidEdwin08

      @smartgenes said in Integrated Music Player for RetroPie [IMP] 2021.10 (Background Music for RetroPie and More):

      @RapidEdwin08 Did it just obliterate the music folder in roms, I could have sworn one existed before? I'm not sure whether it installed or not, is the installer supposed to make a menu screen in emulationstation... I also get an error message which I think is something not caused by the install:

      lvl0: VolumeCintrol::init() - Failed to find mixed elements!
      .

      Are you using a USB for ROM storage via the standard RetroPIe usbromservice?

      On Install IMP will MOVE the ..roms/music Folder to the retropiemenu:
      /home/pi/RetroPie/retropiemenu/imp/music

      It will then attempt to create a Symbolic Link to that new Music Location back in ..roms/music.
      However, if you are using USB Storage, this will fail due to the filesystem type of the USB Storage not supporting symbolic links.
      Any previous music from ..roms/music should have been moved to the new location in retropiemenu.
      This is a known issue with USB Storage, you can see more details a couple posts backin #89 or so.
      IMP won't recognize the music in /roms/music unless it's linked to the main /imp/music DIR.

      For your issue with lvl0: VolumeCintrol::init() - Failed to find mixed elements!, it sounds like you have the wrong Audio Device selected in ES.
      You may want to toggle different Audio Device Settings from the Main Menu -> Sound Settings.
      Try different Audio Devices like PCM,HDMI,Headphone,ect depending on your configuration, back out of the Main Menu to apply/test it.

      Raspberry Pi B, Pi B+, Pi2 B, Pi3 B, Pi3 B+, Pi Zero W, Pi4 (4GB/8GB), Pi5 (8GB/16GB), Pi Zero 2 W, GPi V1, minisforum GK50 / RetroPie 4.8.x

      S 2 Replies Last reply Reply Quote 1
      • S
        smartgenes @RapidEdwin08
        last edited by

        @RapidEdwin08

        1 Reply Last reply Reply Quote 0
        • S
          smartgenes @RapidEdwin08
          last edited by

          @RapidEdwin08 You're absolutely right, I'm storing the roms on external USB, so good to know the files should still be there.

          There is some issue with audio I had before, bizarrely from cold boot I always had to reboot before the audio worked, not sure if it's still like that after I updated retropie. I just updated yesterday and had to purge pulse audio to get the audio on again.

          It may or may not be related to another error I get, 'Failed to get size of gamma for output default'.

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

            @smartgenes @RapidEdwin08
            I read back on some of the older posts and I saw you suggested dropping the music folder as a sub folder in music so that IMP could pick up the music there as the symlink method won't work for me on the USB filesystem (it also doubles as storage for my old Wii).

            I see IMP is in the Retropie menu (and the whole explanation about that being to avoid issues with last game played etc if you had placed it in the menu as a regular roms list with .XML. )

            As for the audio issue:

            cd ~/.emulationstation/
            sudo nano es_settings.cfg

            Then changing "AudioDevice" value = "HDMI"
            seems to have solved the error message as you said.

            However, though I can see the music in the menu in IMP it's still not playing anything yet, even MMMENU.

            RapidEdwin08R 1 Reply Last reply Reply Quote 0
            • RapidEdwin08R
              RapidEdwin08 @smartgenes
              last edited by RapidEdwin08

              @smartgenes
              Have you tried manual command line mpg123 on a music.mp3 file?
              Try putting an mp3 in your home directory and running it manually.

              mpg123 ~/test.mp3
              

              I'm not %100 what all the effects of updating your RetroPie build had on your audio.
              It's debated, but typically recommended to NOT update a working RetroPie build.
              Wondering if there's an issue with mpg123 outputting alsa vs pulse audio ...

              With that said, IMP has mpg123 utilities in the installer.
              You might want to try uninstall reinstall of mpg123. Maybe even try install mpg123 from source if you still have issues, just know source install can take a while...

              Raspberry Pi B, Pi B+, Pi2 B, Pi3 B, Pi3 B+, Pi Zero W, Pi4 (4GB/8GB), Pi5 (8GB/16GB), Pi Zero 2 W, GPi V1, minisforum GK50 / RetroPie 4.8.x

              S 1 Reply Last reply Reply Quote 0
              • S
                smartgenes @RapidEdwin08
                last edited by smartgenes

                @RapidEdwin08 I think it's some other oversight, mpg123 plays the file from the home menu. There's sound in emulationstation as it clicks on key presses in the menu also. I purged pulse audio so I don't think it would be that?

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

                  @smartgenes It might be helpful to know my previous BGM Player was the Naprosnia one. Could this be interfering/what are the instructions for its removal?

                  When I go to the old BGM and select volume, I get the error message:
                  amixer: unable to find simple control 'PCM',0

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

                    @RapidEdwin08 On a rebuild of card it's working, so maybe related to the previous BGM which is not installed this time. What are the options regarding the symlinks - I want to link to my roms folder again, can I change the behaviour of Imp so it just looks to the roms folder or shall I just put all the music in a sub folder in roms/music again?

                    Unfortunately my VolumeControl::init() - Failed to find mixer elements! Is back again too...

                    RapidEdwin08R 1 Reply Last reply Reply Quote 0
                    • RapidEdwin08R
                      RapidEdwin08 @smartgenes
                      last edited by

                      @smartgenes I'm really not sure what your audio issues are, plus IMP merely Disables/Enables Naprosnia, no messing with Audio Settings...

                      For your USB /roms/music/ you can try to create a symbolic link to the Music Folder inside the /imp/music folder instead.

                      mkdir ~/RetroPie/roms/music # If you have not already
                      ln -s ~/RetroPie/roms/music ~/RetroPie/retropiemenu/imp/music/roms-music
                      

                      I do not use the USB Storage method, but the path may vary, so adjust accordingly if needed.

                      Raspberry Pi B, Pi B+, Pi2 B, Pi3 B, Pi3 B+, Pi Zero W, Pi4 (4GB/8GB), Pi5 (8GB/16GB), Pi Zero 2 W, GPi V1, minisforum GK50 / RetroPie 4.8.x

                      1 Reply Last reply Reply Quote 0
                      • ExarKunIvE ExarKunIv referenced this topic on
                      • trickarrow89T
                        trickarrow89
                        last edited by

                        Raspberry Pi 4B 8GB
                        RetroPie 4.7.1

                        Amazing addon! Couple of quick questions -

                        1. Should music be stopped in the Retropie Config menu before entering RetroPie Setup? I noticed that when the music is still playing and you enter the RetroPie Setup, the GUI is rendered useless while music is playing. I am not sure if this is a bug or a coincidence and something else is going on. I did manage to hit CTRL + C to get out of the GUI and back to the RetroPie Config Menu.

                        2. Is it possible to run GUI Navigation Sounds for a theme and IMP simultaneously?

                        RapidEdwin08R 1 Reply Last reply Reply Quote 0
                        • RapidEdwin08R
                          RapidEdwin08 @trickarrow89
                          last edited by

                          @trickarrow89 said in Integrated Music Player for RetroPie [IMP] 2021.10 (Background Music for RetroPie and More):

                          Raspberry Pi 4B 8GB
                          RetroPie 4.7.1

                          Amazing addon! Couple of quick questions -

                          1. Should music be stopped in the Retropie Config menu before entering RetroPie Setup? I noticed that when the music is still playing and you enter the RetroPie Setup, the GUI is rendered useless while music is playing. I am not sure if this is a bug or a coincidence and something else is going on. I did manage to hit CTRL + C to get out of the GUI and back to the RetroPie Config Menu.

                          You should not have to stop the Music.
                          In my case the issue only happens after a Song changes, and I'm able to still control the GUI Menu with Joypad, just have to Select something to Refresh it.
                          I think one of my scripts is doing a 'tput reset' where it does not need to be...

                          Can you try this:

                          nano /opt/retropie/configs/imp/errorcheck.sh
                          

                          Remove or Comment Out the 2nd to Last Line before the exit:

                          • tput reset
                            exit 0

                          OR Comment Out

                          • #tput reset
                            exit 0

                          Does this resolve the GUI issue?

                          1. Is it possible to run GUI Navigation Sounds for a theme and IMP simultaneously?

                          Sure, but you may want to check out the previous post #85 about using Music Over Games Setting...
                          I find that Theme UI sounds work OK, but the Snaps can sometimes clash with the background music.

                          Raspberry Pi B, Pi B+, Pi2 B, Pi3 B, Pi3 B+, Pi Zero W, Pi4 (4GB/8GB), Pi5 (8GB/16GB), Pi Zero 2 W, GPi V1, minisforum GK50 / RetroPie 4.8.x

                          trickarrow89T E 3 Replies Last reply Reply Quote 0
                          • trickarrow89T
                            trickarrow89 @RapidEdwin08
                            last edited by

                            @RapidEdwin08 Thanks - I'll see if I can recreate the issue and look into your recommendations. I'll update you on what I find.

                            As far as the video scrape music/sounds, those work with IMP; both play. You are right though, I just turned off the video scrape music/sounds as it did clash with the background music.

                            1 Reply Last reply Reply Quote 0
                            • E
                              EasyStreetExile @RapidEdwin08
                              last edited by EasyStreetExile

                              @RapidEdwin08 Hey really awesome work here! Sorry for the noob question, but when adding my own music, am I placing it in imp/music folder, or does it need to go into the B-side/A-side folders? Thanks

                              Edit: disregard lol, I got it to work. Thanks again for this great tool

                              RapidEdwin08R 1 Reply Last reply Reply Quote 0
                              • RapidEdwin08R
                                RapidEdwin08 @EasyStreetExile
                                last edited by

                                @EasyStreetExile hardly a noob question...
                                The documentation is not really clear.
                                It says the Roms/Music Directory, but it's not.
                                It's really in the retropiemenu/music Directory.
                                That's on me, and I'll be updating that in the next release due to the recent confusion and issues when using USB Storage service...
                                Thanks for the feedback.

                                Raspberry Pi B, Pi B+, Pi2 B, Pi3 B, Pi3 B+, Pi Zero W, Pi4 (4GB/8GB), Pi5 (8GB/16GB), Pi Zero 2 W, GPi V1, minisforum GK50 / RetroPie 4.8.x

                                1 Reply Last reply Reply Quote 0
                                • trickarrow89T
                                  trickarrow89 @RapidEdwin08
                                  last edited by

                                  @RapidEdwin08 I ended up commenting out the tput reset and I haven't encountered the issue where the GUI in Raspi-Config is inoperable while IMP is playing. I think we're good. I will keep monitoring the issue.

                                  New question - I set IMP to shuffle my playlist on startup and loop it. When I set Retropie (Retropie main menu > UI settings > screensaver settings > system sleep after), the music is still playing. Do you by chance know if there is a way to cut the music when the Retropie goes to sleep? Thanks!

                                  RapidEdwin08R 2 Replies Last reply Reply Quote 1
                                  • RapidEdwin08R
                                    RapidEdwin08 @trickarrow89
                                    last edited by RapidEdwin08

                                    @trickarrow89 Thanks for testing and reporting the results.
                                    I'll remove that 'tput reset' from the errorcheck.sh in the next version.

                                    Currently there are no Settings aimed at or for Sleep in IMP...
                                    But I'll look into it.

                                    Raspberry Pi B, Pi B+, Pi2 B, Pi3 B, Pi3 B+, Pi Zero W, Pi4 (4GB/8GB), Pi5 (8GB/16GB), Pi Zero 2 W, GPi V1, minisforum GK50 / RetroPie 4.8.x

                                    1 Reply Last reply Reply Quote 0
                                    • RapidEdwin08R
                                      RapidEdwin08 @trickarrow89
                                      last edited by RapidEdwin08

                                      @trickarrow89 I looked into the Sleep 0ptions and it turned out to be a pretty Great Idea, because it can be used for Screensaver as well (eg. stop IMP if Video Screensaver).

                                      It's pretty straight forward using the Emulationstation built-in scripting 0ptions found here:
                                      Emulationstation Scripting

                                      For now, if you want to test yourself, you can borrow the current IMP Scripts used for run-onstart/run-onend.
                                      (NOTE: the run-onstart/run-onend Scripts will Respect Music Over Game Settings + Fade Settings, we're just borrowing them for now)

                                      Create the Directory for ES Built-In Scripts first:

                                      mkdir ~/.emulationstation/scripts
                                      

                                      Create/Copy the IMP scripts for Sleep/Wake:

                                      mkdir ~/.emulationstation/scripts/sleep
                                      echo 'bash /opt/retropie/configs/imp/run-onstart.sh &' > ~/.emulationstation/scripts/sleep/impstop.sh
                                      echo 'exit 0' >> ~/.emulationstation/scripts/sleep/impstop.sh
                                      sudo chmod 755 ~/.emulationstation/scripts/sleep/impstop.sh
                                      
                                      mkdir ~/.emulationstation/scripts/wake
                                      echo 'bash /opt/retropie/configs/imp/run-onend.sh &' > ~/.emulationstation/scripts/wake/impstart.sh
                                      echo 'exit 0' >> ~/.emulationstation/scripts/wake/impstart.sh
                                      sudo chmod 755 ~/.emulationstation/scripts/wake/impstart.sh
                                      

                                      0r 0ptionally Create/Copy the IMP scripts for Screensaver Start/Stop:

                                      mkdir ~/.emulationstation/scripts/screensaver-start
                                      echo 'bash /opt/retropie/configs/imp/run-onstart.sh &' > ~/.emulationstation/scripts/screensaver-start/impstop.sh
                                      echo 'exit 0' >> ~/.emulationstation/scripts/screensaver-start/impstop.sh
                                      sudo chmod 755 ~/.emulationstation/scripts/screensaver-start/impstop.sh
                                      
                                      mkdir ~/.emulationstation/scripts/screensaver-stop
                                      echo 'bash /opt/retropie/configs/imp/run-onend.sh &' > ~/.emulationstation/scripts/screensaver-stop/impstart.sh
                                      echo 'exit 0' >> ~/.emulationstation/scripts/screensaver-stop/impstart.sh
                                      sudo chmod 755 ~/.emulationstation/scripts/screensaver-stop/impstart.sh
                                      

                                      To Disable, simply Remove/Delete the Scripts from corresponding Directories...

                                      I tested on stock RetroPie v4.8 and both Sleep and Screensaver scripts and worked as expected.
                                      If it works well, I will try to incorporate these 0ptions into the next release.

                                      Raspberry Pi B, Pi B+, Pi2 B, Pi3 B, Pi3 B+, Pi Zero W, Pi4 (4GB/8GB), Pi5 (8GB/16GB), Pi Zero 2 W, GPi V1, minisforum GK50 / RetroPie 4.8.x

                                      trickarrow89T 3 Replies Last reply Reply Quote 0
                                      • trickarrow89T
                                        trickarrow89 @RapidEdwin08
                                        last edited by

                                        @RapidEdwin08 - Awesome! Thanks for looking into this. I'll give it a shot today and update the string with my experience.

                                        1 Reply Last reply Reply Quote 0
                                        • trickarrow89T
                                          trickarrow89 @RapidEdwin08
                                          last edited by

                                          @RapidEdwin08 - the sleep/wake script worked like a charm. Here's just an overview of what I did in case anyone stumbles on this string:

                                          • I SSH'd into RetroPie using PuTTY and copied over the sleep wake script.
                                          • Performed a reboot:
                                          sudo reboot
                                          
                                          • After the reboot, I went into the RetroPie Main Menu (Start) > UI Settings > Screensaver Settings > Screensaver After > 1m.
                                          • Then went to System Sleep After in the same menu screen and set the sleep timer to 5 minutes.

                                          The system entered a screensaver which I had set to use Random Videos from my scraped ROMs. The screensaver started and 5 minutes into the screensaver, the system went to sleep, stopping IMP. When I woke the system up (with the A button), the IMP kicked on and picked up right where it left off.

                                          Right now, I have my scraped ROM random video screensaver set to mute so the IMP plays my playlist over the screensaver, which I like.

                                          For testing purposes, I'll also implement the screensaver script just to see what happens. Stay tuned.

                                          1 Reply Last reply Reply Quote 0
                                          • trickarrow89T
                                            trickarrow89 @RapidEdwin08
                                            last edited by

                                            @RapidEdwin08 - Alright, I set up your script for just the screensaver screensaver start/stop and that worked as well. Here is a recap of what I did:

                                            • I SSH'd into RetroPie using PuTTY and copied over the screensaver start/stop script.
                                            • Performed a reboot:
                                            Sudo reboot
                                            
                                            • After the reboot, I went into the RetroPie Main Menu (Start) > UI Settings > Screensaver Settings > Screensaver After > 3m.
                                            • Then went to System Sleep After in the same menu screen and disabled the sleep timer by setting it to 0 minutes (both the system sleep on/off and screensaver start/stop scripts can be installed, I just wanted to test this specific script).

                                            The system entered screensaver mode, which I had set to use Random Videos from ROM scrapes, and IMP stopped playing. I hit A, the screensaver stopped and the system put me back into Emulation Station with IMP picking up where it left off in the playlist.

                                            Both scripts were a success for RetroPie v4.8 on a Raspberry Pi 4B 8GB.

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