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 61.0k 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 @hopwon
      last edited by RapidEdwin08

      @hopwon You can check the IMP Output log file right after a Reboot before you Press anything IMP Related in ES.

      /dev/shm/current-playlist
      

      You can also check the actual Playlist Files to confirm the Path to MP3s is correct.
      (NOTE: the current-track Log file in this Location is only used when LITE Mode is DISABLED)

      /opt/retropie/configs/imp/playlist
      

      Are you able to get Music playing at B00T at all?
      Tried any other Settings with BGM Disabled?
      Do you hear the startup.mp3 Play at B00T?
      Trying to determine if the issue isolated to BGM settings, Audio device, or the Music Files themselves...

      Are you sure ALL the songs in the BGM Folder play?
      One known issue is that any File with a Double-Space will not play with mpg123 Issue#4
      Another known issue is with Files that have no metadata mentioned Here.

      The "unable to get current volume" is an issue with IMP Not being able to detect the audio device properly at FADE.
      You can Disable FADE for now to get rid of the message
      May be related to the audio hat in use, as I personally do not own or ever tested, but we can definitely troubleshoot that later as well if you're up for it.

      Edit* Another thought regarding the audio hat, try increasing the Delay of IMP at B00T...
      I'm guessing the audio hat has additional drivers/scripts being loaded at startup?
      I wonder if IMP is starting playback before the audio hat is loaded.
      Can you check the status of the # Current Playlist # after a Reboot?
      If it's playing, you can try increasing the Delay.

      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 2 Replies Last reply Reply Quote 0
      • RapidEdwin08R RapidEdwin08 referenced this topic on
      • H
        hopwon @RapidEdwin08
        last edited by hopwon

        @RapidEdwin08 There is no startup.mp3 plays which makes me think delaying the start is a top suggestion.
        It's a vanilla install and copied a few mp3 into the default folder as I did think that might have been an issue, but no.
        Will dig into the issue tomorrow and feed back.
        Thanks again!

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

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

          @hopwon You can check the IMP Output log file right after a Reboot before you Press anything IMP Related in ES.

          /dev/shm/current-playlist
          

          You can also check the actual Playlist Files to confirm the Path to MP3s is correct.
          (NOTE: the current-track Log file in this Location is only used when LITE Mode is DISABLED)

          /opt/retropie/configs/imp/playlist
          

          Are you able to get Music playing at B00T at all?
          Tried any other Settings with BGM Disabled?
          Do you hear the startup.mp3 Play at B00T?
          Trying to determine if the issue isolated to BGM settings, Audio device, or the Music Files themselves...

          Are you sure ALL the songs in the BGM Folder play?
          One known issue is that any File with a Double-Space will not play with mpg123 Issue#4
          Another known issue is with Files that have no metadata mentioned Here.

          The "unable to get current volume" is an issue with IMP Not being able to detect the audio device properly at FADE.
          You can Disable FADE for now to get rid of the message
          May be related to the audio hat in use, as I personally do not own or ever tested, but we can definitely troubleshoot that later as well if you're up for it.

          Edit* Another thought regarding the audio hat, try increasing the Delay of IMP at B00T...
          I'm guessing the audio hat has additional drivers/scripts being loaded at startup?
          I wonder if IMP is starting playback before the audio hat is loaded.
          Can you check the status of the # Current Playlist # after a Reboot?
          If it's playing, you can try increasing the Delay.

          @RapidEdwin08 Check the following:

          IMP Output post boot:

          pi@SpaceInvader:~ $ uptime
          10:33:13 up 0 min,  2 users,  load average: 1.01, 0.35, 0.12
          pi@SpaceInvader:~ $ cat /dev/shm/current-playlist
          cat: /dev/shm/current-playlist: No such file or directory
          

          Red Flag?

          pi@SpaceInvader:/opt/retropie/configs/imp/playlist $ cat current-track 
          High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
          	version 1.25.10; written and copyright by Michael Hipp and others
          	free software (LGPL) without any warranty but with best wishes
          Decoder: generic
          Trying output module: alsa, device: <nil>
          
          Directory: /home/pi/RetroPie/retropiemenu/imp/music/bgm/A-SIDE/
          Playing MPEG stream 1 of 1: 08 - Confusion [Alternate Version] [Instrumental].mp3 ...
          
          MPEG 1.0 L III cbr320 44100 stereo
          
          Title:   Confusion [Alternate Version] [Instrumental]
          Artist:  New Order
          Comment:                             
          Album:   Power, Corruption & Lies [Collector's Edition] Disc 2
          Year:    2008                            Genre:  Alternative                   
          > 04864+12622  02:07.05+05:29.72 --- 005=005 320 kb/s 1045 B acc    0 clip p+0.000
          > 0000+0000  00:00.
          
          > 0000+0000  00:00.
          
          

          No music playing at boot at all. I did put a 30 second delay in but no change

          Listing of music directory:

          pi@SpaceInvader:~/RetroPie/retropiemenu/imp/music/bgm/A-SIDE $ ls -l
          total 253420
          -rw-r--r-- 1 pi pi 12623967 Feb 14 18:36 '01 - Age of Consent.mp3'
          -rw-r--r-- 1 pi pi 18104457 Feb 14 18:36 '01 - Blue Monday.mp3'
          -rw-r--r-- 1 pi pi 16461878 Feb 14 18:37 '01 - Crystal.mp3'
          ...... loads more
          
          

          Lets forget the fade issue for now.
          Regarding drivers for the hat, its included in the /boot/config.txt:

          # Enable audio (loads snd_bcm2835)
          #dtparam=audio=on
          dtparam=audio=off
          dtoverlay=hifiberry-amp
          
          

          This is the correct config for this device, as I mentioned everything works as expected.

          Current settings:

          ,-------------------------------------------------------.               
           | Music @Boot: ON  Delay: 030 |          LITE Mode: OFF | 
           | startup.mp3: ON  @quit: ON  |      INFINITE Mode: ON  | 
           | BGM A~SIDE:  ON B~SIDE: ON  |    Music OVER Game: OFF | 
           | Shuffle Playlist @Boot: ON  | FADE Volume Out/In: x5  | 
           | 0MXM0N:OFF  RANDOMIZER: BGM |    DELAY @Game End: OFF | 
           | Volume%40 @Screensaver: VID |    Stop IMP @Sleep: ON  | 
           `-------------------------------------------------------'  
           http.server: [OFF] [http://192.168.1.85:8080] [STOPPED]
           Music: /home/pi/RetroPie/retropiemenu/imp/music
          
          

          My guess at this stage is that the audio driver is not loaded at startup, even with the 30 second delay.
          More than happy to help troubleshoot/assist in making this work with you

          H 1 Reply Last reply Reply Quote 0
          • H hopwon referenced this topic on
          • H
            hopwon @hopwon
            last edited by hopwon

            @RapidEdwin08 Bit more info:

            Running these from the cmd line:

            bash /opt/retropie/configs/imp/boot.sh
            
            

            Waits 30 seconds then starts playing music beautifully ,then gives me this error output:

            sed: -e expression #1, char 0: no previous regular expression
            sed: -e expression #1, char 0: no previous regular expression
            sed: -e expression #1, char 0: no previous regular expression
            pi@SpaceInvader:/opt/retropie/configs/all $ 
            
            pi@SpaceInvader:/opt/retropie/configs/all $ cat autostart.sh
            #while pgrep omxplayer >/dev/null; do sleep 1; done
            emulationstation --no-splash#auto
            bash /opt/retropie/configs/imp/boot.sh > /dev/null 2>&1 & #auto
            emulationstation #auto
            
            

            Two ES entries, is this by design?

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

              @RapidEdwin08
              Manually changed autostart.sh to

              #while pgrep omxplayer >/dev/null; do sleep 1; done
              bash /opt/retropie/configs/imp/boot.sh > /dev/null 2>&1 & #auto
              emulationstation --no-splash#auto
              
              

              And lo and behold it works! BGM happiness :)

              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):

                Two ES entries, is this by design?

                No, I'm pretty sure IMP added the Extra emulationstation #auto entry by mistake due to the installer not taking into account the emulationstation --no-splash#auto entry.
                Basically the autostart was loading Emulationstation Twice, and IMP was only set to start before the 2nd entry.
                In this state, if you were to Quit ES, it would have reloaded a 2nd time, this time with IMP playing.
                Glad you found this.

                There should be a backup named autostart.sh.b4imp
                Can you confirm the content of the Backup autostart.sh before IMP?
                I will try to update the installer to accommodate.

                cat /opt/retropie/configs/all/autostart.sh.b4imp
                

                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

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

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

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

                  Two ES entries, is this by design?

                  No, I'm pretty sure IMP added the Extra emulationstation #auto entry by mistake due to the installer not taking into account the emulationstation --no-splash#auto entry.
                  Basically the autostart was loading Emulationstation Twice, and IMP was only set to start before the 2nd entry.
                  In this state, if you were to Quit ES, it would have reloaded a 2nd time, this time with IMP playing.
                  Glad you found this.

                  There should be a backup named autostart.sh.b4imp
                  Can you confirm the content of the Backup autostart.sh before IMP?
                  I will try to update the installer to accommodate.

                  cat /opt/retropie/configs/all/autostart.sh.b4imp
                  

                  Thanks for the Feedback

                  Here you go:

                  pi@SpaceInvader:/opt/retropie/configs/all $ cat autostart.sh.b4imp 
                  #while pgrep omxplayer >/dev/null; do sleep 1; done
                  emulationstation --no-splash#auto
                  pi@SpaceInvader:/opt/retropie/configs/all $ 
                  
                  

                  You are correct, I put the second ES line back in and tried what you suggested and indeed, when I quit ES, it restarted with BGM!

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

                    @hopwon For the Fade issue...

                    Are you able to Adjust/Retain Volume in ES Sound Settings?
                    Or does the Volume setting get lost when you try to adjust from ES.
                    If Volume does not retain, try to find the correct Combination of AudioDevice/AudioCard, then you can try to Enable Fade again in IMP and Test.

                    If Volume is working fine and AudioDevice/AudioCard Settings are correct, can you confirm the output of these commands:

                    cat /opt/retropie/configs/all/emulationstation/es_settings.cfg | grep "AudioCard"
                    cat /opt/retropie/configs/all/emulationstation/es_settings.cfg | grep "AudioDevice"
                    amixer | grep "Simple mixer control" | grep -v 'Capture'
                    

                    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
                    • buzzardbaitB
                      buzzardbait @RapidEdwin08
                      last edited by

                      @RapidEdwin08 Took me a few days to get this tested. I ended up using the method from ~/imp/imp_setup.sh - selecting Add quit song option from the [PC/0ther] Utilities. And it did work!

                      But before that, when I entered:

                      cat /etc/systemd/system/impquit.service
                      

                      I did get this message returned:

                      [Unit]
                      Description=IMP Stop + Quit Song
                      DefaultDependencies=no
                      Conflicts=reboot.target power off.target halt.target shutdown.target
                      After=network.target
                      
                      [Service]
                      Type=oneshot
                      RemainAfterExit=yes
                      ExecStart=/bin/true
                      ExecStop=/opt/retropie/configs/imp/impquit.sh
                      
                      [Install]
                      WantedBy=multi-user.target
                      

                      I don't know enough to figure out what was going on from there, but if that's helpful, thought I'd pass it along.

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

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

                        @hopwon For the Fade issue...

                        Are you able to Adjust/Retain Volume in ES Sound Settings?
                        Or does the Volume setting get lost when you try to adjust from ES.
                        If Volume does not retain, try to find the correct Combination of AudioDevice/AudioCard, then you can try to Enable Fade again in IMP and Test.

                        If Volume is working fine and AudioDevice/AudioCard Settings are correct, can you confirm the output of these commands:

                        cat /opt/retropie/configs/all/emulationstation/es_settings.cfg | grep "AudioCard"
                        cat /opt/retropie/configs/all/emulationstation/es_settings.cfg | grep "AudioDevice"
                        amixer | grep "Simple mixer control" | grep -v 'Capture'
                        

                        Hi, been away for a few days.
                        The fade issue fixed itself once we worked out that that IMP was not starting due to the duplicate entries in autostart.sh.
                        Everything is working perfectly now :)
                        Massive thanks again for your time.

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

                          @RapidEdwin08 reading @hopwon 's responses and despite me pretty much getting things to work, you mention a few things that might solve my problem.. Previously I was copying a lot of old configs from backups of RetroPie 4.7.x for fresh installs onto a new card, which probably impacted my RetroPie 4.8.3 setup. I pulled up some of the log files and I was getting some error messages that made sense- I wouldn't be surprised if some of that stuff might have been interfering with IMP in certain ways.

                          Working on a fresh install with a fresh card- been careful to sort through the configs I'll need only, from my old backup, and we'll see what happens. Thanks- I'll report back.

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

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

                            emulationstation --no-splash#auto

                            Current version of IMP Setup has been updated to adjust for the issue @hopwon experienced with multiple emulationstation entries in autostart .sh.

                            The installer was already configured to look for [--no-splash #auto], but Not [emulationstation --no-splash#auto].

                            @hopwon I don't know if it was a typo or not, but I'm pretty sure there's supposed to be a SPACE before #auto in your entry here:

                            emulationstation --no-splash#auto
                            emulationstation --no-splash #auto

                            I'd venture to guess you are probably still seeing the ES splash screen without that space before #auto.
                            Either way, IMP Setup will now accommodate this scenario, and correct 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

                            mituM H 2 Replies Last reply Reply Quote 0
                            • mituM
                              mitu Global Moderator @RapidEdwin08
                              last edited by

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

                              @hopwon I don't know if it was a typo or not, but I'm pretty sure there's supposed to be a SPACE before #auto in your entry here:
                              emulationstation --no-splash#auto
                              emulationstation --no-splash #auto

                              No, a space is not required after the parameters. If your detection script tries to look for the line where emulationstation command is started, either look for ^emulationstation or #auto to find it, both should work fine.

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

                                @mitu said

                                No, a space is not required after the parameters. If your detection script tries to look for the line where emulationstation command is started, either look for ^emulationstation or #auto to find it, both should work fine.

                                @mitu Thanks for the feedback (and everything else you do for the community), it's always appreciated.
                                I've seen some Pi Images where emulationstation is not at the beginning of the line, so I do not use ^ for the detection here.

                                Also, I thought the same thing about the space not making an impact, until I added it to my autostart .sh for testing the issue previously experienced by @hopwon.
                                In my case, on a stock retropie 4.8 build, the ES Splash screen still displays when there's no space in [emulationstation --no-splash#auto].

                                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

                                  [v2023.03] Released

                                  LITE Mode Now Retains Last Track/Position at Poweroff if Properly Shutdown.
                                  New Feature 0ptional User Gamelist (imp-user-gamelist.xml)
                                  Added x2 More [SomaFM] Internet Radio Stations to [Streams] (cliqhop,darkzone)
                                  Various Visual Tweaks Added to Utilities Menu and Main Menu
                                  Tweaks to Installer applying to [autostart .sh] (emulationstation --no-splash)

                                  Again, Thanks All 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

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

                                    @RapidEdwin08 Quick question, will it play VGM, SPC etc. like Naprosnia's player? I use it for that feature as they're small files and I can have authentic game music in EmulationStation.

                                    Thanks for all your work on this, looks ace!

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

                                      @segasonic No...
                                      IMP uses mpg123 as the main player, so only mp3 support + .pls and m3u.

                                      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 1
                                      • S
                                        segasonic @RapidEdwin08
                                        last edited by

                                        @RapidEdwin08 Thanks for the reply! I'll try it out anyway, got plenty of game music mp3s.

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

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

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

                                          emulationstation --no-splash#auto

                                          Current version of IMP Setup has been updated to adjust for the issue @hopwon experienced with multiple emulationstation entries in autostart .sh.

                                          The installer was already configured to look for [--no-splash #auto], but Not [emulationstation --no-splash#auto].

                                          @hopwon I don't know if it was a typo or not, but I'm pretty sure there's supposed to be a SPACE before #auto in your entry here:

                                          emulationstation --no-splash#auto
                                          emulationstation --no-splash #auto

                                          I'd venture to guess you are probably still seeing the ES splash screen without that space before #auto.
                                          Either way, IMP Setup will now accommodate this scenario, and correct it.

                                          It was a typo :)

                                          GrassiniG 1 Reply Last reply Reply Quote 1
                                          • GrassiniG
                                            Grassini @hopwon
                                            last edited by

                                            Great player! I'm only missing one feature to be happy - changing the song using the button on the pad/keyboard (like in batocer for example, where the button is used - in this case by clicking the left analogue). Is this feasible to implement?

                                            RapidEdwin08R 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.