Introduction to mpg123

Forum rules
Share your brain ;)
machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Introduction to mpg123

Unread post by machinebacon » Fri Oct 21, 2016 2:56 pm

An underrated little program - everyone plays around with mocp or cmus, though mpg123 deserves a bit of attention, too.

Turn on the keyboard controls with the -C switch, and play a song from your hard drive:

Code: Select all

mpg123 -C /home/weirdo/music/my_song.mp3
Play a radio stream from URL and set the buffer to 3000 Kb

Code: Select all

mpg123 -b 3000 -Q http://url.to/stream.m3u
What probably nobody knows: mpg123 has an equalizer. Well, not a clicky-pointy one. It reads from an equalizer file, let's call this one ~/rock.eq

Code: Select all

# mpg123 eq
# Rock
#
1 1
1 1
0.9 0.9
0.9 0.9
0.8 0.8
0.7 0.7
0.5 0.5
0.5 0.5
0.5 0.5
0.5 0.5
0.3 0.3
0.2 0.2
0.2 0.2
0.3 0.3
0.3 0.3
0.2 0.2
0.2 0.2
0.3 0.3
0.5 0.5
0.5 0.5
0.5 0.5
0.7 0.7
0.7 0.7
0.8 0.8
0.8 0.8
0.8 0.8
1 1
1 1
1 1
1 1
1 1
1 1
Now you play your song with the EQ using the -E flag

Code: Select all

mpg123 -C -E ~/rock.eq /home/weirdo/fav_porn/Rock_&_Roll_MILF.mp3
For more EQ's, let's open a separate thread (anyway nobody gives a fuck)

Some frontends:

playmp3 - lists all music files (that contain STRING if given as option)
http://www.linuxbbq.org/bbs/viewtopic.php?f=15&t=2038

mp3player - simple frontend for playmp3 using dialog

Code: Select all

#!/bin/bash

. /usr/share/doc/dialog/examples/setup-vars
. /usr/share/doc/dialog/examples/setup-tempfile

MP3LIST=~/.mp3list
printf '%s\n' **/*.mp3 > $MP3LIST

while true
do
   ar=()
   while read n s ; do
      ar+=($n "$s")
   done < $MP3LIST

   dialog --clear --menu "mp3player" 0 0 0 "${ar[@]}" 2> $tempfile
   retval=$?
   case $retval in
      $DIALOG_CANCEL)
      exit 0;;
   esac
   mpg123 -C -q `cat $tempfile`
done
Ok, now go back to mocp... :p
..gnutella..

Post Reply