Background Music [Continued from Help/Support]
-
@synack said in Background Music [Continued from Help/Support]:
@retrobean Not to derail the thread or take away from @Livewire's contribution here, but you can also just use an external mp3 player such as mpg123 to play music without worrying about details.
- install mpg123
sudo apt-get install mpg123
- edit /opt/retropie/configs/all/autostart.sh and before emulationstation is called;
while pgrep omxplayer >/dev/null; do sleep 1; done mpg123 -Z /home/pi/bgm/*.mp3 >/dev/null 2>&1 &
- edit /opt/retropie/configs/all/runcommand-onstart.sh
pkill -STOP mpg123
- edit /opt/retropie/configs/all/runcommand-onend.sh
pkill -CONT mpg123
- edit /home/pi/.bashrc and add
[[ $(tty) == "/dev/tty1" ]] && pkill mpg123
This will randomly play mp3s from the specified folder (step 2), pause the player upon entering a game, resume when exiting, and also stop the player when exiting emulationstation and dropping to a bash shell.
I'm following this method but I have an issue on autostart.sh incorrect syntax on line 4. This is how I have set up autostart.sh:
while pgrep omxplayer >/dev/null; do sleep 1; done mpg123 -Z /home/pi/bgm/*.mp3 >/dev/null 2>&1 & emulationstation auto#
I don't get it where I wrong, the synack's code is before the emulationstation and there isn't a line 4!
-
Cant get it to work? here is my settings.
-
@retronerd
It looks like in your 1st picture of/etc/rc.local
you are trying to execute/home/pi/PyScripts/Test1.py
but
in the 2nd picture (unless I'm mistaken) is of???/pi/.config/PyScripts/Test1.py
The 3rd picture I can't tell if it is correct unless I see what's inside your
Test1.py
-
ive changed the folder Scripts to PI/Scripts but it doesnt work:(?
i havent changed anything in the script so the music folder shall be in roms right?
-
ive changed the folder Scripts to PI/Scripts but it doesnt work:(?
The other thing I would check is if that Script is executable. Run this to make it executable:
chmod +x /home/pi/PyScripts/Test1.py
If it already was executable running this will not harm anything.
i havent changed anything in the script so the music folder shall be in roms right?
Yes @Livewire's script uses
/home/pi/RetroPie/roms/music/
for the Music directory -
Thanks but that doesnt solve my problem????
-
@retronerd
Oh, make sure in/etc/rc.local
that(sudo python /home/pi/PyScripts/Test1.py) &
is all on one single line.Your 1st picture shows it on 2 lines.
-
ive changed to 1 line but doesnt work
-
ive changed to 1 line but doesnt work
Hmmm....just to verify, did you run
sudo apt-get install python-pygame
-
@backstander yes what im doing wrong?
look at the S on script is that right? its from 1 page here -
-
what im doing wrong?
Hmmm...I'm kind of stumped right now.
look at the S on script is that right? its from 1 page here
That uppercase 'S' is correct in
/home/pi/PyScripts/Test1.py
Your picture of the
Test1.py
looks correct as well. -
@backstander thats strange! ?????
-
@backstander
can i unistall this and install it again somehow? -
@retronerd
To uninstall use the step I posted above here:
https://retropie.org.uk/forum/topic/347/background-music-continued-from-help-support/125Also here is an alternative script that kind of does the same thing. Maybe try to follow this one instead:
https://retropie.org.uk/forum/topic/347/background-music-continued-from-help-support/43 -
@backstander ive tried the alternative script but i got this error?
-
@retronerd
Try this first:
sudo apt-get update
Then try:
sudo apt-get install mpg123
-
its seems to download:)
how do i edit /opt/retropie/configs/all/autostart.sh which command? -
how do i edit /opt/retropie/configs/all/autostart.sh which command?
Most of us use that program "nano" to edit files from the command line. Examples below!
step 2:
nano /opt/retropie/configs/all/autostart.sh
step 3:
nano /opt/retropie/configs/all/runcommand-onstart.sh
step 4:
nano /opt/retropie/configs/all/runcommand-onend.sh
step 5:
nano /home/pi/.bashrc
If any of those won't let you save your changes, then add
sudo
before thenano
likesudo nano blah blah blah...
-
Thanks! but where shall i put [[ $(tty) == "/dev/tty1" ]] && pkill mpg123 in last step?
where shall i put my music?
in step 2: shall i put it the row under emulationstation #auto?
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.