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

RetroPie X86 - Background Music Guide



  • This was written by RennyC on our Discord and he wanted me to post it here for others to use. I did some formatting to it alongside some punctuation.


    1. First follow the instructions to install RetroPie BGM Player v2.0 @ https://github.com/Naprosnia/RetroPie_BGM_Player .

    2. The installation will be successful, however, it'll complain about autostart.sh. Sadly, the x86 RetroPie version
      doesn't actually use or have an autostart.sh, which is where the fun begins.

    3. What we're gonna do is hijack the .desktop autostart symlink and tell it to run EmulationStation and play music. First create an autostart.sh file in your /HOME/.config/autostart and paste the following inside of it:

    #!/bin/bash
    nohup $HOME/RetroPie-BGM-Player/bgm_system.sh -i --autostart >/dev/null 2>&1 &
    pid=$!
    exec gnome-terminal --full-screen --hide-menubar -e emulationstation
    
    1. Now you need to enter the terminal and go to your /HOME/.config/autostart/ folder and type:

    sudo nano retropie.desktop

    then replace the Exec= line with this: Exec=/home/<your user>/.config/autostart/autostart.sh.

    Ctrl-O to save and Ctrl-X to Exit.

    MAKE SURE <YOUR USER> IS CHANGED TO YOUR LOGIN/USERNAME.

    Now RetroPie will play music on start, however, we aren't done yet!

    1. The next task is to replace runcommand-onstart.sh and runcommand-onend.sh
      so proceed using terminal to your /opt/retropie/configs/all/ folder and type

    sudo nano runcommand-onstart.sh

    then replace everything inside with this:

    bash $HOME/RetroPie-BGM-Player/bgm_system.sh -s
    pkill -9 audacious
    

    Ctrl-O to save and Ctrl-X to Exit.

    Now type:

    sudo nano runcommand-onend.sh

    then replace everything inside with this:

    bash $HOME/RetroPie-BGM-Player/bgm_system.sh -p
    nohup $HOME/RetroPie-BGM-Player/bgm_system.sh -i --autostart >/dev/null 2>&1 &
    

    We now have the music script shutting down on launching an emulator and restarting itself when coming back to
    EmulationStation.

    1. The only thing left to do is have EmulationStation kill the music on exit, so we will now bring our terminal to the
      /opt/retropie/supplementary/emulationstation/ folder and type:

    sudo nano emulationstation.sh

    Before the exit $ret line insert:

    pkill -9 audacious

    Ctrl-O to save and Ctrl-X to Exit.

    That's it! Enjoy.

    All credit goes to andrew from the Redream Discord.


    The original write-up can be found here: https://pastebin.com/pMARQB2L

    I don't know a thing about RetroPie x86 so all I'll be able to do to any replies to this is fix any mistakes or add any improvements.



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.