Project: Python background music package for EmulationStation
-
Some time ago I saw this post consisting of a python script that plays music and fades it up/down depending on whether you run an emulator or not. Heavily inspired by this, I decided to refactor and structure the code, and set up a debian packaging infrastructure for it so that anyone can create its own debian package out of it for their Retropie system, and placed it into a repository so that other users can easily install and get it running in no time.
The github repo Background Music for EmulationStation where I host this project is this one: https://github.com/Rydra/bgm-for-es
How to install
Enter the RetroPie console (you can reach it by pressing the F4 key when EmulationStation is running) and run the following commands:
sudo echo "deb [trusted=yes] https://repo.fury.io/rydra/ /" > /etc/apt/sources.list.d/es-bgm.list sudo apt update sudo apt install python-pygame python-es-bgm
These commands will update your sources and install the python-es-bgm package which will run your music. Afterwards, place your music in the music folder (as described in the How it works section) and either restart EmulationStation or reboot your Raspberry.
How it works
Place your music in .mp3 or .ogg format in the folder that will be created in /home/pi/RetroPie/roms/music. You can change the folder where you place your music by editing the file /etc/bgmconfig.ini.
Help required
It is the first time I make a Debian package, and I'm sure that a helping, more experienced hand in these matters can lend me a hand or give me some tips. Same goes for python development and python coding structure and standards. I would really appreciate feedback out from that as well as users.
I would also appreciate any bug report if you find something amiss.
Thank you,
Rydra
-
I am going to give this a shot on my Odroid XU4 build for grins and see if it will work on that too! I will report back.
-
Works great for me, but I had to follow the instructions from the Github page and used this to install it.
sudo sh -c 'echo "deb [trusted=yes] https://repo.fury.io/rydra/ /" > /etc/apt/sources.list.d/es-bgm.list'
sudo apt update
sudo apt install python-pygame python-es-bgm
-
I've noticed the music won't fade out after launching Super Mario War from the ports section. Is there any way to make the music fade for that?
-
It has potential, but there are some bugs which prevend me from using it.
I have the same issue as Quackwalks: I have Prince of persia 1 in Ports and the music continues when you start the game.
Also the music continues despite starting the following emulators: ppsspp(Sony PSP), amiberry(Amiga), drastic (Nintendo DS).
At first I thought the music only stopped when starting a libretro emulator, but that's not true (music did stop after starting my non libretro N64 and dosbox emulators.)Also I am trying to set a start song (ps1 bootup sound), but I am unsuccesful so far.
I opened the bgmconfig.ini file and edited it to:
startsong = Sony.mp3 (then ctrl x to save)
I also tried
startsong = /home/pi/RetroPie/roms/music/Sony.mp3But it still starts up with a random song. Has anyone managed to set a startsong?
-
I didn't get any further with the method in this topic. But I did find one that is a lot more straightforward:
http://www.pretendo.online/2017/01/25/adding-background-music-to-emulation-station/
It has all the same functionalities and more.Press F4 in emulationstation and type the following:
sudo apt-get install python-pygame
(You’ll need to type “y
” when prompted)
mkdir -p ~/PyScripts
wget -O ~/PyScripts/bgmusic.py http://pastebin.com/raw/KpUaZuSz
sudo nano /etc/rc.local
Insert “(sudo python /home/pi/PyScripts/bgmusic.py) &
” (without quotes) on any line before the “exit 0
” line
Press Ctrl+o, Enter, then Ctrl+x to save changes and exit the editor
Connect through Windows to \retropie\roms\ and create a folder called “music
”. Place your mp3s in there.
If you want to edit the script you can use this command to edit:
nano ~/PyScripts/bgmusic.py
When finished you can press Ctrl+o, Enter, then Ctrl+x to save and exit.After you've followed all the steps you can easily edit the bgmusic.py file. There is a list of all the emulators in the file. Just add the ones missing, so the program mutes the music as well when those emulators start.
I saw sdlpop (prince of persia from the ports section) in this list, but it still didn't mute. To solve this, first I started Prince of Persia on the Pi, then I opened Winscp on my computer, connected to the Pi, opened a terminal and hit 'ps -A'. With this command you see all the processes running on the Pi. That's where I saw the emulator for Prince of persia is actually called prince. The method might work for you too for Super mario war. -
the post that @BobHarris posted is the one that i use and once you edit the file to have all the emulators that are missing it works great.
if someone can make it easier for other people to get it going that would be great, i know a few people are scared away from it
-
@exarkuniv I think they are mostly scared away because there are so many of these methods floating around and many don't work that well. The steps in the link I mentioned are actually pretty simple and it works great. It's a very nice addition to my build, I'm still busy finding great songs to add...the youtube channel of SupraDarky is very helpful..he has a large library of video game music.
(Though of course it would be easier if it was integrated in the pre-made Retropie image. The script could include every possible emulator. People would only need to put songs in the music folder. Personally though I like having to work and research a bit for these functionalities.)
-
@bobharris If I go with what you suggested, I'm guessing I don't need to worry about uninstalling anything related to the python-es-bgm package, or do I?
-
Just out of curiosity, why are most of you still using the old python script over synack's mpg123 method, which I personally find to be superior?
-
@maplestory I didn't know there was a newer method. But why do you say it's superior? So far I can't find any problems with the 'old' Python script.
At first glance the method you use even seems less superior. You don't mention a file you can configure? In the python script I set the Playstation 1 boot up sound as my startsong so I always hear that when I boot up my Pi, love it!
Edit: I read through your topic and it seems like you can set a startsong as well. The only thing it maybe is superior in, is you don't have to write down all the emulators in the script (in order for the music to mute for all of them)?
-
@quackwalks I don't know about that. I started fresh with a backed up image. (I backed it up right before I installed the python-es-bgm package.)
But you're better off using the method Maplestory mentioned, as by default it uses a differently named music folder ('bgm' instead of 'music'). So if you leave the 'music' folder empty, then the python-es-bgm script can't do anyhing.(But it does look like it's working differently from the method I suggested: the newer method seems to mute when it sees the runcommand screen can be activated (right after you start most emulators)). But some emulators bypass this screen, so the music does not automatically mute then.)
-
i could not stand the way that it just cut off the music with syack way. so that is why i dont use it.
as far as which one is superior. as you say it is all personal preference. -
I cannot get this removed. I try
sudo apt remove python-es-bgm
and I getdpkg: error processing package python-es-bgm (--remove): subprocess installed post-removal script returned error exit status 1 Errors were encountered while processing: python-es-bgm E: Sub-process /usr/bin/dpkg returned an error code (1)
Any ideas? I actually cannot install or uninstall anything, this error from the particular package keeps appearing!
Edit: nevermind, I removed it from
/var/lib/dpkg/status
and did adpkg --configure -a
. I hope it's clean now... -
-
-
-
-
-
-
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.