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 46.7k 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.
    • 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
                • RapidEdwin08R
                  RapidEdwin08 @trickarrow89
                  last edited by RapidEdwin08

                  @trickarrow89 Thanks for testing and the feedback.
                  I'll add Idle/Sleep settings for IMP in the next release.

                  I may try to use screensaver-game-select too,
                  But I'm not really sure if/how the %media% argument randomvideo is supposed to be utilized...

                  Would be ideal to have a setting to Stop IMP only on Screensaver Random Video if possible.

                  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 1 Reply Last reply Reply Quote 0
                  • trickarrow89T
                    trickarrow89 @RapidEdwin08
                    last edited by

                    @RapidEdwin08 - Wish I could help here. I am in the midst of learning Linux's CLI (commands, scripts, bash, etc.). The good news is that I am picking it up because I could read and understand the sleep/wake scripts you wrote.

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

                      @trickarrow89 I could not figure out the randomvideo argument for screensaver-game-select...
                      I ended up just scripting out a check for the random video setting in the es_settings.cfg instead.

                      That worked as expected, so IMP will have Settings for Idle at Screensaver ANY, or Idle at Screensaver Random Video Only in the next release.

                      I also finally tested IMP on a PC build of RetroPie (latest Mint Cinnamon Ubuntu base).
                      There were some issues on PC I did not encounter on Pi...
                      I ended up making a bunch of changes under the hood to get it working.

                      Next IMP should be compatible with PC (and 0droid potentially).

                      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 1
                      • RapidEdwin08R
                        RapidEdwin08
                        last edited by RapidEdwin08

                        It's the 1 Year Anniversary Edition of IMP!
                        Lots of changes and new additions to this version...
                        If you tried IMP on a PC Before and had Issues, there were several changes made to support PC in this version.
                        Anyone tried IMP on 0droid yet?
                        I've yet to confirm if IMP works on 0droid, but I do not see why it wouldn't...

                        Feel free to report any Issues here.
                        Thanks all for the Feedback.

                        [v2022.10] Released

                        Main IMP Music Folder now Documented Properly [../retropiemenu/imp/music]
                        Added Symbolic Link to [../roms/music] in Main IMP Music Folder
                        Several Fixes under the hood for PC/0ther Compatibility
                        Added [PC/0ther] Utilities to Installer Menu
                        Updated mpg123 Utilities to include [v1.30.2]
                        Modified mpg123 Utilities Source Build Folder to ~/mpg123...
                        Added [Clean Source Folder] Option to mpg123 Utilities
                        Added Setting to Play [quit.mp3] Song at ES Quit
                        Modified Fade mechanism to Check/Use Audio Device from [es_settings.cfg]
                        Added IMP Idle Settings
                        Added OMX Monitor [BETA]
                        Added [Streams/Minimal/Offline] Install Flags to Installer Menu
                        SomaFM for Everyone!
                        Divided the Single [NightrideFM.pls] into x6 [Individual.pls] Stations in [Streams]
                        Added More [Mp3RadioFM] Internet Radio Stations to [Streams] (Results may vary)
                        Added Lower Bandwidth Channels to SLAYRadio/DnBRadio [Streams]

                        New Feature OMX Monitor [BETA]:
                        1mp_omxmon.png

                        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 buzzardbaitB 2 Replies Last reply Reply Quote 1
                        • trickarrow89T
                          trickarrow89 @RapidEdwin08
                          last edited by

                          @RapidEdwin08 - is it still recommended to completely uninstall the older version and then retrieve the latest version?

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

                            @trickarrow89 Yes Uninstall current Version before installing newer IMP.
                            You can see this process in the updated Video in the OP for reference.

                            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

                            buzzardbaitB 1 Reply Last reply Reply Quote 1
                            • buzzardbaitB
                              buzzardbait @RapidEdwin08
                              last edited by

                              @RapidEdwin08 Just did a fresh update of RetroPie 4.8.2, with the updated Pixelcade software (I have an LED marquee), and this update of IMP. I had been waiting to do this on a fresh MicroSD card because I already had a completely stable system running with RetroPie 4.7.21 and didn't want to break anything.

                              The new IMP features are GREAT! Thanks for all the hard work. I now have a fun startup mp3 that plays before IMP plays a randomized selection from EITHER my A-Side or B-Side folders.. Music stops when the screensaver starts, fades in/out going in and out of games.. I have a funny goodbye mp3 when it shuts down.. it is really awesome.

                              Thanks again for all the thorough work on this- if anyone is on the fence about installing, let me just say IMP is a great choice. This is a really full-featured enhancement for RetroPie with a lot of options for whatever you might want to do with background music.

                              FWIW- I am on a Pi 4B 4GB RAM running in an arcade cabinet with:

                              • RetroPie 4.8.2
                              • Pixelcade 4.4.5
                              • IMP 2022.10
                              1 Reply Last reply Reply Quote 1
                              • buzzardbaitB
                                buzzardbait @RapidEdwin08
                                last edited by

                                @RapidEdwin08 So I have noticed something, not sure if I have a setting wrong or if anyone else is experiencing this.

                                I set up an mp3 as my "Quit mp3" for when I shut the Pi down from EmulationStation.

                                What happens, is the BGM playing continues to play, and the Quit mp3 plays concurrently- both mp3s play until the Quit mp3 has played in full, and then the Pi shuts down.

                                What I expected to happen- the BGM stops or fades out, and then the Quit mp3 plays, and then the Pi shuts down.

                                My settings in IMP are:
                                1. Music @ Boot - ON
                                2. Delay - 5 sec.
                                3. Startup mp3 - ON
                                4. Quit mp3 - ON
                                5. A-Side - ON
                                6. B-Side - ON
                                7. Shuffle playlist @ Boot - ON
                                8. OMX Monitor - OFF
                                9. Randomizer - BGM
                                10. Stop IMP @ screensaver - VIDEO
                                11. Lite Mode - OFF
                                12. Infinite Mode - OFF
                                13. Music Over Game - OFF
                                14. Fade in/out - ON
                                15. Delay @ Game end - OFF
                                16. Stop at sleep - OFF

                                Running:

                                • RetroPie 4.8.2
                                • IMP 2022.10
                                • Pixelcade 4.4.5 (don't think this matters, but FYI).

                                Any recommendations?
                                Thanks!

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

                                  @buzzardbait Your attention to detail is uncanny and appreciated.

                                  I would suggest you use the [PC/0ther] Utilities in [~/imp/imp_setup.sh] and Apply this setting:
                                  Add [IMP-STOP] to Emulationstation [Quit]

                                  NOTE: This will stop IMP @Restart of ES as well.

                                  Long story short, adding the Quit song to Emulationstation's default quit/ Scripting location was the place I wanted to use to get the Quit song to play @Shutdown/Restart without diving into the system OS or using systemd ect...

                                  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
                                    last edited by RapidEdwin08

                                    IMP v2023.01 Released

                                    Changed Play [quit.mp3] Song to a systemd Service to address Music 0verlapping issue (at ES Quit 0ption still Available in PC Utilities).
                                    Added Fade x1/x5/x10 Interval Settings for Adjustable Fade Speeds (to address Slow Fade issue on PlayBox V2 Vanilla).
                                    Modified Fade mechanism to perform Additional Check if Audio Device from [es_settings.cfg] not found in amixer check.
                                    OMX Monitor Version [RC1] (No Reports of Bugs, No Changes, Release Candidate).
                                    Updated mpg123 Utilities to include [v1.31.2]
                                    Fixed BGM A-Side/B-Side playback issue when set at boot.
                                    Adjusted errorcheck .sh, was too vague stopping at any error:

                                    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

                                    buzzardbaitB 1 Reply Last reply Reply Quote 1
                                    • buzzardbaitB
                                      buzzardbait @RapidEdwin08
                                      last edited by

                                      @RapidEdwin08 So I have installed the latest version on a fresh SD card, and I did get everything working fine, EXCEPT the quit.mp3.

                                      My setup is:
                                      RPi 4B, 4GB
                                      RetroPie 4.8.2
                                      IMP 2023.01 with these settings:
                                      1. Music @ Boot - ON
                                      2. Delay - 5 sec.
                                      3. Startup mp3 - ON
                                      4. Quit mp3 - ON
                                      5. A-Side - ON
                                      6. B-Side - ON
                                      7. Shuffle playlist @ Boot - ON
                                      8. OMX Monitor - OFF
                                      9. Randomizer - BGM
                                      10. Stop IMP @ screensaver - VIDEO
                                      11. Lite Mode - OFF
                                      12. Infinite Mode - OFF
                                      13. Music Over Game - OFF
                                      14. Fade volume out/in - 1X
                                      15. Delay @ Game end - OFF
                                      16. Stop at sleep - OFF

                                      I have A-SIDE & B-SIDE filled with music, a startup.mp3 file and a quit.mp3 file; upon boot, IMP will play my startup.mp3 and then select either A-SIDE or B-SIDE and play a random selection from it. So far, great!

                                      When I shutdown Emulationstation, the quit.mp3 will not play at all. Music just stops and then the Pi shuts down.

                                      Am I missing a setting in the new version?

                                      When I used the PREVIOUS version of IMP (2022.10), the behavior I was getting was the same, except in shutdown, when the quit.mp3 DID play but simultaneously with previously playing music; followed by normal shutdown.

                                      (The quit.mp3 file isn't the issue- it definitely works.)

                                      Thanks for any help!

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

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

                                        @RapidEdwin08 So I have installed the latest version on a fresh SD card, and I did get everything working fine, EXCEPT the quit.mp3.

                                        ...This is why I didn't want to use systemd in the first place; mixed results...
                                        Not sure what the issue is, sounds like you have stock Raspbian/RetroPie image on pi4?

                                        1st thing you can try is to Uninstall/Reinstall IMP...
                                        As usual, I made a few fixes/changes after the initial release, and one of them pertained to the systemd quit service.
                                        It's possible you have a version before I adjusted it Here

                                        If you still have issues you can try these commands to troubleshoot:

                                        cat /etc/systemd/system/impquit.service #Show Content
                                        
                                        sudo systemctl daemon-reload #Reload may show errors
                                        
                                        sudo systemctl stop impquit.service #Should hear quit.mp3
                                        sudo systemctl enable impquit.service
                                        sudo systemctl start impquit.service
                                        
                                        sudo systemctl daemon-reload #Reload may show errors
                                        

                                        If all else fails, for now you can apply the 0lder method from [~/imp/imp_setup.sh].
                                        It is still retained in [PC/0ther] Utilities: Add quit song to ES Quit.

                                        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

                                        H buzzardbaitB 2 Replies Last reply Reply Quote 0
                                        • H
                                          hopwon @RapidEdwin08
                                          last edited by hopwon

                                          @RapidEdwin08 First off, thank you for IMP, I have been trying to get a BGM working on my setup for weeks, then I found this and minutes later I have the biggest smile on my face! I appreciate the work you put in, its fantastic. It works as advertised and I have even been able to add my own tunes!

                                          I have a query I hope its easy enough for you to point me in the right direction.
                                          I cannot get the BGM music to start automatically, if I go into the menu and select Start BGM, it works perfectly. But following a reboot it does not start. Where can I look to see that it is correctly configured to start post boot?

                                          I have Rpi4, latest build of RetroPie & I am using a hifiberry-amp hat. I can confirm that all the other features work, in game sounds work fine etc.

                                          I'm fairly adept at scripting, and have been playing with Pi's for years :)

                                          
                                          #cat  /opt/retropie/configs/imp/settings/music-startup.flag
                                          1
                                          -rw-r--r-- 1 pi pi   2 Feb 14 18:40 music-startup.flag
                                          

                                          Thanks in advance!

                                          Screenshot from 2023-02-15 10-25-09.png

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

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

                                            I cannot get the BGM music to start automatically, if I go into the menu and select Start BGM, it works perfectly. But following a reboot it does not start. Where can I look to see that it is correctly configured to start post boot?

                                            Thanks for the feedback...

                                            From your screenshot it looks like you already have BGM A Enabled, so it should be working, and playing only A-Side at boot.

                                            I believe I found and fixed this issue about a week ago, but I could be wrong.
                                            You might have installed before I made the changes Here.
                                            You can try to uninstall, re-download ~/imp setup, and re-install.
                                            I recommend fresh install as I made a few other changes/fixes since the release as well.

                                            Or if you want, you can check the [boot .sh], and just #Comment# the bad lines out.

                                            [/opt/retropie/configs/imp/boot.sh] Lines 83-86:

                                            	# Replace rpMenu/music Path with roms/Music Path in Playlist files - No Longer Required - No Longer Works
                                            	#sed -i s+$ESCmusicDIR+$ESCmusicROMS+ /dev/shm/abc
                                            	#sed -i s+$ESCmusicDIR+$ESCmusicROMS+ /dev/shm/shuffle
                                            	#sed -i s+$ESCmusicDIR+$ESCmusicROMS+ /dev/shm/init
                                            

                                            I also wanted to elaborate on the BGM Settings VS Randomizer at B00T while the topic is relevant.

                                            BGM A-Side Enabled: Plays ONLY BGM A-Side at B00T overriding any previous playlist
                                            BGM B-Side Enabled: Plays ONLY BGM B-Side at B00T overriding any previous playlist
                                            BOTH A-Side/B-Side Enabled: Plays BOTH A/B Side together as single playlist at B00T

                                            Randomizer Mode ON: Supersedes BGM at B00T
                                            Randomizer ALL: Respects BGM A/B Settings allowing you to Include OR Exclude BGM from Randomizer playlist at B00T
                                            Randomizer BGM: Plays 0nly EITHER BGM A-Side OR BGM B-Side at B00T overriding any previous playlist
                                            Randomizer PLS: Plays only Random Playlist Files .PLS/.M3U

                                            Also, a quick reminder about Music Over Games and RetroArch Audio Driver Here

                                            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

                                            H 1 Reply Last reply Reply Quote 0
                                            • RapidEdwin08R RapidEdwin08 referenced this topic on
                                            • 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.