
Add MPG123 Terminal Music Player to Raspberry Pi, Linux
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 suck 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
aterm -e mpg123 -CvZ ~/Music/*.mp3
exit
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.
[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
On my computer website:
- Exploring Digital Computer Electronics
- Presario 1999 CM1001 Gaming Computer Salvage
- Salvage, Test 2012 AAEON EMB-B75A Industrial Motherboard
- Hardware Review Connecting PC Parallel Ports
- Main Light Fast Linux Desktops with Openbox, JWM
- Test Reuse Surplus PC Power Supplies
- Add WBAR Launch Dock to Raspberry Pi
- Add MPG123 Terminal Music Player to Raspberry Pi, Linux
- Basics of Alsamixer Audio Control for Linux
- Add Solid State Hard Drive to Raspberry Pi
- Beep a PC Speaker Add Beeper to Raspberry Pi
- Using FEH Wallpaper Setter Under Linux
- 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
- Tutorial Xinitrc Desktop Manager Control for Linux
- Setup Raspberry Pi Using JWM Window Manager
- Web Master
- Gen. Electronics Homepage
- YouTube Channel
- Current Control Circuits
- Design LM317 Constant Current Circuits
- Constant Current Circuits with the LM334
- Experiments with TL431A Shunt Regulator
- Transistor Circuits
- H-Bridge Motor Control with Power MOSFETs
- Insulated Gate Bipolar Transistor IGBT Circuits
- ULN2003A Darlington Transistor Array with Circuit Examples
- Power Supply Basics
- Basic Power Supply Rectification Tutorial
- Basic Triacs and SCR Projects and Circuits
- Transistor-Zener Diode Regulator Circuits
- Arduino Microcontroller
- Arduino Code Examples
- Rotary Encoder Using Arduino Hardware Interrupts
- Raspberry Pi Single Board Computer
- Raspberry Pi Openbox Linux System
- ADS1115 4-Channel ADC Uses I2C with Raspberry Pi
- +Microchip PIC Controllers
- Microchip PIC12F683 Programming Circuits Tutorial
- Microchip PIC16F628A Assembly
- WiringPi and Pulse-Width-Modulation with Raspberry Pi
- WiringPi for Raspberry Pi and MAX6675 thermal-couple sensor
- WiringPi Blink an LED Demo
- Interface I2C LCD to Raspberry Pi in C
- ADS1115 4-Channel ADC Uses I2C with Raspberry Pi
- MCP4725 12-Bit DAC Interface to Raspberry Pi
- Raspberry Pi with PCF8591 Analog To Digital Control in C
- Raspberry Pi PCF8591 AD-DA Sensor Python Interface
- Quick navigation of this website:
- Basic Electronics Learning and Projects
- Arduino Microcontroller Projects
- Raspberry Pi and Linux
- Connecting a PC Printer Port to Electronics with Python
- Microchip PIC 18F2550
- PICAXE Microcontroller
Web site Copyright Lewis Loflin, All rights reserved.
If using this material on another site, please provide a link back to my site.