These are the installation steps for the program I'm using (different from mpg123):
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.
(In the file called bgmusic.py there is a list of emulator names. A few are missing (for example the PSP emulator). This means that the music does not stop playing when starting a game in such an emulator. But that is solved easily by adding the name of the emulator to the file. To find out the name of an emulator, start a game in the specific emulator, then open Winscp (or a similar program) on your computer, connect to the Pi, open a terminal and type 'ps -A'. With this command you see all the processes running on the Pi. )
It's a very nice little program. Music plays randomly and it fades in and out in between games and, in the bgmusic.py file, you can set a song that always plays when booting the Pi (I'm using the PS1 intro music)