Add MPG123 Terminal Music Player to Raspberry Pi, Linux
by Lewis Loflin
MPG123 is a fast console MPEG Audio Player and decoder library. It works in a terminal. It consumes almost no system resources and I use it for background music on my desktop.
I works on standard Linux and Raspberry Pi. To install:
~ $ sudo apt-get install mpg123
The website is https://www.mpg123.de.
How to Use
Open a terminal and type the following and you get the above assuming folder Music is in your home folder and has mp3s:
~ $ aterm -e mpg123 -CvZ ~/Music/*.mp3
With aterm it can be any terminal in your system such as lxterminal in Raspberry Pi.
Let's set this up as a bash script and save in your $HOME/bin folder. Open a text editor:
#!/bin/bash
# -C, --control Enable terminal control keys.
# -v --verbose
# -Z random loop
lxterminal -e mpg123 -CvZ ~/Music/*.mp3
exit
Note you can use any terminal you have such a aterm, xterm, etc.
Save and close.
This will play every song at in the directory random forever. Leave out -Z and it will play every song in the directory in alphabetical order then exit.
The -C allows one to display a help menu by typing h.

Above is my Python audio menu.
Save the above as mpg123.sh (or rename it anything other than mpg123) in you bin folder or /usr/local/bin. Add the command you your menu.
Make the file executable:
~ $ sudo chmod +x mpg123.sh
Below are various terminal commands. Some may not working depending on how the binaries were compiled.
[s] or [ ] interrupt/restart playback (i.e. 'pause')
[f] next track
[d] previous track
[b] back to beginning of track
[p] pause while looping current sound chunk
[.] forward
[,] rewind
[:] fast forward
[;] fast rewind
[+] volume up
[-] volume down
[r] RVA switch
[v] verbose switch
[l] list current playlist, indicating current track there
[t] display tag info (again)
[m] print MPEG header info (again)
[h] this help
[q] quit
- Software and setup:
- Raspberry Pi Openbox Desktop 2019
- Setting up Openbox for Raspberry Pi
- Using FEH Wallpaper Setter Under Linux
- Add MPG123 Terminal Music Player to Raspberry Pi, Linux
- Basics of Alsamixer Audio Control for Linux
- Tutorial Xinitrc Desktop Manager Control for Linux
- Main Light Fast Linux Desktops with Openbox, JWM
- Test Reuse Surplus PC Power Supplies
- Add WBAR Launch Dock to Raspberry Pi
- Add Solid State Hard Drive to Raspberry Pi
- Beep a PC Speaker Add Beeper to Raspberry Pi
- Scrot Lite Weight Screen Shot Software for Linux
- Using Light Weight Beaver Text Editor
- Install Viewnior Image Viewer for Linux
- Zmixer ALSA Sound Control Tutorial
- Setup Raspberry Pi Using JWM Window Manager
- Live Linux Distro for Using Printer Port with Electronics
- Using the powerful Rox-Filer system in Linux
- Use FEH under Linux for a Wallpaper Setter
- How to create Symbolic links in Linux
- Exploring Digital Computer Electronics
- Hardware
- Hardware Review Connecting PC Parallel Ports
- Operation TB6600 Stepper Controller with PC Parallel Port
- Build or Buy Parallel Port Breakout Board?
- Build Serial HD44780 LCD Display Connect to Parallel Port
- Motherboards
- Presario 1999 CM1001 Gaming Computer Salvage
- Live Test 2002 VIA EPIA-800 Mini ITX Motherboard
- Salvage, Test 2012 AAEON EMB-B75A Industrial Motherboard
Web site Copyright Lewis Loflin, All rights reserved.
If using this material on another site, please provide a link back to my site.