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

    Modified Background Music Script with added overlays!

    Scheduled Pinned Locked Moved Ideas and Development
    bgmoverlaymusicsongscript
    114 Posts 22 Posters 39.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.
    • madmodder123M
      madmodder123
      last edited by madmodder123

      I edited the background music script posted here: https://retropie.org.uk/forum/topic/347/background-music-continued-from-help-support
      With this edited script, songs that are being played will be displayed within ES and updated as the music changes.
      EXAMPLE PICTURES HERE

      I used imagemagick to generate pictures of song titles and then used pngview to display the generated .png files on top of the linux framebuffer.
      I also added some code to adjust the image size/location depending on what output resolution is being used.
      There is a section to adjust things such as font, text/background color, size, location, etc.

      I made a shell script to make installing this way easier!
      https://github.com/madmodder123/retropie_music_overlay/blob/master/BGM_Install.sh
      Just download that file, move it to your Pi, mark it as executable, and then run it.
      "sudo chmod +x BGM_Install.sh" to make it executable.
      Make sure you DO NOT RUN THE SCRIPT AS ROOT OR IT WILL FAIL. Use: "./BGM_Install.sh"

      You will still have to set up the script to run automatically when the Pi boots!:
      Run "sudo nano /etc/rc.local"
      Near the bottom, on the line above "exit 0", put the following code

      su pi -c 'python ~/BGM.py &'
      

      Press Control+X, Y, and Enter to save changes.
      Example rc.local file

      EDIT: I updated the script so it creates a menu entry to disable/enable the music !
      EDIT 2: I updated the script so you can choose how long you want the overlay to be displayed! (set to 8 seconds by default!)
      EDIT 3: I updated the script so you can choose if you would like the corners of the overlay to be rounded
      EDIT : Updated to NOT USE ROOT and changed "/home/pi/" to "~/" for other systems (such as ODROID)

      1 Reply Last reply Reply Quote 6
      • G
        gleam2003
        last edited by

        Thank you for inspiration


        This is my mod emulationstation with BGM and popup title

        TriquickT madmodder123M L 3 Replies Last reply Reply Quote 2
        • TriquickT
          Triquick @gleam2003
          last edited by

          @gleam2003 What build/settings do you have to control the background music from a menu?

          J 1 Reply Last reply Reply Quote 2
          • J
            Jste84 @Triquick
            last edited by

            @triquick said in Modified Background Music Script with added overlays!:

            @gleam2003 What build/settings do you have to control the background music from a menu?

            I also would like to know how to do this

            1 Reply Last reply Reply Quote 0
            • madmodder123M
              madmodder123 @gleam2003
              last edited by

              @gleam2003 It is funny, a guy on reddit gave me the idea for this so i made it a script, and then my script gave you the idea to edit ES to add it. It is cool how ideas change forms

              1 Reply Last reply Reply Quote 1
              • G
                gleam2003
                last edited by

                I edit the emulationstation source code and add bgm as module.
                I'm developing it for my distro made for orangepi devices but I can port all to RetroPie for Raspberry.
                My distro for OrangePi is available at www.nintendont.it
                At this time I have no lot of time but if you are patients I will share with you when find time.

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

                  @gleam2003 IMHO if you're distributing modifications of ES you should also distribute the sources, since ES is under GPL. Is the https://github.com/nintendontit/EmulationStation repository the one with the modifications you made ?

                  1 Reply Last reply Reply Quote 1
                  • G
                    gleam2003
                    last edited by

                    First: wrong es isn't gpl, RetroPie have gpl license, emulationstation don't appear to have gpl license but mit license.

                    Second: all emulationstation modification have be realise as patch files, but only for what I have already released.

                    mituM darkniorD 2 Replies Last reply Reply Quote 1
                    • mituM
                      mitu Global Moderator @gleam2003
                      last edited by

                      @gleam2003 said in Modified Background Music Script with added overlays!:

                      First: wrong es isn't gpl, RetroPie have gpl license, emulationstation don't appear to have gpl license but mit license

                      Yes, you're correct, only the RetroPie setup has the GPL license, ES seems to be under the MIT License.

                      herb_fargusH 1 Reply Last reply Reply Quote 0
                      • herb_fargusH
                        herb_fargus administrators @mitu
                        last edited by

                        @mitu said in Modified Background Music Script with added overlays!:

                        ES seems to be under the MIT License

                        That doesn't include ES themes which all have licences of their own (not to mention the funny idea that compilations of others logos could constitute ones own "copyright") Most of which being derived from simple which has non commercial clauses. But anyways...

                        If you read the documentation it will answer 99% of your questions: https://retropie.org.uk/docs/

                        Also if you want a solution to your problems read this first: https://retropie.org.uk/forum/topic/3/read-this-first

                        1 Reply Last reply Reply Quote 0
                        • darkniorD
                          darknior @gleam2003
                          last edited by

                          @gleam2003 Please can you really make a pull request to the ES master (dev) branch to give us your music player on ES ?
                          It can be really cool <3

                          Life is game, just play it !

                          1 Reply Last reply Reply Quote 0
                          • darkniorD
                            darknior
                            last edited by

                            @madmodder123 Hi
                            Today i have try to test your script but i have a problem.

                            apt-get install imagemagick
                            
                            git clone https://github.com/AndrewFromMelbourne/raspidmx.git
                            cd pngview/
                            make
                            
                            pi@retropie:~/src/raspidmx/pngview $ make
                            cc -Wall -g -O3 -I../common -I/usr/include/libpng12 -I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -g -c pngview.c -o pngview.o -Wno-deprecated-declarations
                            cc -o pngview -Wl,--whole-archive pngview.o -L/opt/vc/lib/ -lbcm_host -lm -lpng12 -L../lib -lraspidmx -Wl,--no-whole-archive -rdynamic
                            /usr/bin/ld: ne peut trouver -lraspidmx
                            collect2: error: ld returned 1 exit status
                            Makefile:16: recipe for target 'pngview' failed
                            make: *** [pngview] Error 1
                            

                            Must we install all the package ?
                            Thanks

                            Life is game, just play it !

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

                              @darknior said in Modified Background Music Script with added overlays!:

                              @madmodder123 Hi
                              Today i have try to test your script but i have a problem.

                              apt-get install imagemagick
                              
                              git clone https://github.com/AndrewFromMelbourne/raspidmx.git
                              cd pngview/
                              make
                              
                              pi@retropie:~/src/raspidmx/pngview $ make
                              cc -Wall -g -O3 -I../common -I/usr/include/libpng12 -I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -g -c pngview.c -o pngview.o -Wno-deprecated-declarations
                              cc -o pngview -Wl,--whole-archive pngview.o -L/opt/vc/lib/ -lbcm_host -lm -lpng12 -L../lib -lraspidmx -Wl,--no-whole-archive -rdynamic
                              /usr/bin/ld: ne peut trouver -lraspidmx
                              collect2: error: ld returned 1 exit status
                              Makefile:16: recipe for target 'pngview' failed
                              make: *** [pngview] Error 1
                              

                              Must we install all the package ?
                              Thanks

                              Here's how I handled it, starting inside the git clone of that repo:

                              cd lib
                              make
                              cp libraspidmx.so* /usr/local/bin
                              nano /etc/ld.so.conf
                              (type /usr/local/lib into a new line alone, save and quit nano
                              ldconfig
                              cd ../pngview
                              make
                              cp pngview /usr/local/bin/
                              ldd /usr/local/bin/pngview (if you did everything right here, you should see all required libraries are present and accounted for)

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

                                @madmodder123 It's probably a better idea to actually have the song_title.png be output to somewhere like /dev/shm which is a tmpfs kept in RAM so that you don't keep writing this file to the SD card.

                                madmodder123M 1 Reply Last reply Reply Quote 1
                                • madmodder123M
                                  madmodder123 @zerojay
                                  last edited by

                                  @zerojay Great idea! Thanks for letting me know i'll adjust the code! I'm glad you told me about that folder, you learn something new with linux every day :)

                                  1 Reply Last reply Reply Quote 1
                                  • R
                                    RichyMX
                                    last edited by RichyMX

                                    Hey @madmodder123 thanks for working on such a nice addition to my retropie build, however, I would like to pick your brain a bit since I'm having. Issues with it.

                                    I followed adding your script to the PyScripts folder and switched the previous music script I had with your updated one, despite this fact, there's no song_title.png being created ever and I can't seem to find out what the problem is, would you mind help me figuring it out?

                                    Music plays fine so I'm sure I did THAT right at least.

                                    Best regards

                                    EDIT: Found out why it wasn't working, the script point to /usr/bin/pngview where as @zerojay mentioned at a previous comment the following:
                                    Here's how I handled it, starting inside the git clone of that repo:

                                    cd lib
                                    make
                                    cp libraspidmx.so* /usr/local/bin
                                    nano /etc/ld.so.conf
                                    (type /usr/local/lib into a new line alone, save and quit nano
                                    ldconfig
                                    cd ../pngview
                                    make
                                    cp pngview /usr/local/bin/
                                    ldd /usr/local/bin/pngview (if you did everything right here, you should see all required libraries are present and accounted for)

                                    As you can see within these instructions pngview points at /usr/local/bin

                                    1 Reply Last reply Reply Quote 0
                                    • W
                                      war3zlod3r
                                      last edited by

                                      I'm having a similar problem, I get the background music but I never get the overlay or images created, I double checked and pngview is in /usr/local/bin and the command is executable with out error from the terminal. How can I troubleshoot this script?

                                      madmodder123M 1 Reply Last reply Reply Quote 0
                                      • madmodder123M
                                        madmodder123 @war3zlod3r
                                        last edited by madmodder123

                                        @war3zlod3r
                                        I wrote a script that gets everything all set up for ya!
                                        https://github.com/madmodder123/retropie_music_overlay/blob/master/BGM_Install.sh
                                        Just download that, make it executable and then run it and it should work just fine, I just tested it on a fresh install :)

                                        1 Reply Last reply Reply Quote 2
                                        • madmodder123M
                                          madmodder123
                                          last edited by

                                          I updated the main post with the script and more instructions :)

                                          1 Reply Last reply Reply Quote 2
                                          • madmodder123M
                                            madmodder123
                                            last edited by

                                            I updated the script so it makes a menu item that lets you instantly enable/disable the BGM :)

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