RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Play music playlist on emulationstation (when idle)

    Scheduled Pinned Locked Moved Help and Support
    emulationstatonsoundplaylistmp3script
    19 Posts 5 Posters 1.9k 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.
    • H
      Hyuma
      last edited by

      thanks, the second one seems very interesting, i will test that!

      1 Reply Last reply Reply Quote 0
      • H
        Hyuma
        last edited by

        I made a bash script with the command taken from your second link:

        mpg123 -Z /home/pi/bgm/*.mp3 &

        to load in backround random mp3 inside bgm folder... I want to load and stop this script using some combo with joystick or buttons... is possible?

        mituM 1 Reply Last reply Reply Quote 0
        • mituM
          mitu Global Moderator @Hyuma
          last edited by

          @hyuma There's no mechanism to bind a script to a button press in Emulationstation. However, what you can do is add a script to toggle the music and add it in the RetroPie system. It will appear as a menu item and you can just 'start' it to call your music toggle script.

          Z 1 Reply Last reply Reply Quote 0
          • H
            Hyuma
            last edited by

            oh what a pity :/ i called the script "hadoken" and I would have loved to activate it with an "hadoken" combo :D

            1 Reply Last reply Reply Quote 0
            • Z
              zerojay @mitu
              last edited by zerojay

              @mitu said in Play music playlist on emulationstation (when idle):

              @hyuma There's no mechanism to bind a script to a button press in Emulationstation. However, what you can do is add a script to toggle the music and add it in the RetroPie system. It will appear as a menu item and you can just 'start' it to call your music toggle script.

              That's not actually true. Here's a script that you can adopt to do it: https://www.reddit.com/r/RetroPie/comments/777ylv/how_to_map_a_controller_to_soft_reboot_your_system/

              Here's also a way of using emulated music rips directly from the games as your background music: https://retropie.org.uk/forum/post/120089

              I have a script that allows you to use both mp3s and these emulated music rips in the same playlist that could be further extended to other formats as well. I haven't released it quite yet though.

              cyperghostC H 2 Replies Last reply Reply Quote 2
              • cyperghostC
                cyperghost @zerojay
                last edited by

                @zerojay I nearly forget the sort shuf command. That is a good way to create playlist with shuffle option on mpg123

                Z 1 Reply Last reply Reply Quote 0
                • Z
                  zerojay @cyperghost
                  last edited by

                  @cyperghost said in Play music playlist on emulationstation (when idle):

                  @zerojay I nearly forget the sort shuf command. That is a good way to create playlist with shuffle option on mpg123

                  Yep, that's exactly what I've done, but not just for mp3s.

                  cyperghostC 1 Reply Last reply Reply Quote 0
                  • cyperghostC
                    cyperghost @zerojay
                    last edited by

                    @zerojay Yes but mpg123 gots a native shuffle command it is the -Z parameter. Disadvantage is that you do not see which track is played next. So use find command with shuffle and create a playlist to volatile path \dev\shm is an option to be considered

                    1 Reply Last reply Reply Quote 0
                    • N
                      NightShadowPT
                      last edited by

                      I have implemented it on my RetroPie, but when I'm at the command line and the music loops, it just messes up the display with all the data about the MP3 its playing.

                      Is there a way to just make it loop "silently" (i.e. not send any data to the console)?

                      Cheers

                      mituM 1 Reply Last reply Reply Quote 0
                      • mituM
                        mitu Global Moderator @NightShadowPT
                        last edited by

                        @nightshadowpt said in Play music playlist on emulationstation (when idle):

                        Is there a way to just make it loop "silently" (i.e. not send any data to the console)?

                        Yes, it's described in the original topic at https://retropie.org.uk/forum/topic/9133/quick-and-easy-guide-for-adding-music-to-emulatonstation-on-retropie-noob-friendly. Look at how mpg123 is started and add the necessary arguments.

                        N 1 Reply Last reply Reply Quote 0
                        • H
                          Hyuma @zerojay
                          last edited by

                          @zerojay thanks for links, i will study that!

                          cyperghostC 1 Reply Last reply Reply Quote 0
                          • N
                            NightShadowPT @mitu
                            last edited by

                            @mitu Thanks! I'll look into it...

                            1 Reply Last reply Reply Quote 0
                            • cyperghostC
                              cyperghost @Hyuma
                              last edited by

                              @hyuma @NightShadowPT

                              The magic of silent working in background is here

                              mpg123 -Z /home/pi/bgm/*.mp3 >/dev/null 2>&1 &
                              

                              Mpg123 is command
                              -Z is endless shuffle of dir /home/pu/bgm

                              Now the magic of > means
                              Send all messages from stderr = 2
                              To stdout = 1
                              Send stdout to nirvana

                              At last the last &
                              Means send the whole process to background

                              1 Reply Last reply Reply Quote 1
                              • N
                                NightShadowPT
                                last edited by

                                Thanks for the in depth explanation... it's always good to understand what I am typing :)

                                Anyway, I found a mistake on my initial typing. Instead of this:
                                mpg123 -Z /home/pi/bgm/*.mp3 >/dev/null 2>&1 &

                                I had this (note the missing > after the 2):
                                mpg123 -Z /home/pi/bgm/*.mp3 >/dev/null 2&1 &

                                So that should be the culprit.

                                After fixing it, every time I exit to the console I get a message saying "/opt/retropie/configs/all/autostart.sh: line 2: 935 Terminated" and the music is turned off.

                                Not sure if this is the intended behavior, but it works for me. :)

                                cyperghostC 1 Reply Last reply Reply Quote 0
                                • H
                                  Hyuma
                                  last edited by

                                  @zerojay reading that reddit topic has to be interensting, but i have some question... how can I adapt a combination of jstest reading in a .sh script? As the hadoken is something similar to: alt text

                                  I have to read down, down right, right, punch, right? and after that the script must be running forever in emulationstation idle time.. so when i do that move the playlist start.. is this thinking correct?

                                  1 Reply Last reply Reply Quote 0
                                  • cyperghostC
                                    cyperghost @NightShadowPT
                                    last edited by

                                    @nightshadowpt the 2>&1 is mandatory to hide error messages from output, too

                                    Your direction points standard output to nirvana but error messages are still displayed.

                                    1 Reply Last reply Reply Quote 0
                                    • H
                                      Hyuma
                                      last edited by

                                      Ok I've tested jslisten but only accept 4 button pressed at once and seems no button sequence working...

                                      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.