Configuring Multimedia Apps

Configuring Multimedia Applications

OK. So, we’ve configure the sound card and walked through the GUI CD interfaces in both Gnome and KDE. Linux also provides a strong collection of tools for listening to mp3 files. You can listen with a GUI or without. Today, I’ll point you to an mp3 tool that’s a built-in for most Linux distributions: mpg123.

As you know, I much prefer command line tools to GUIs. They’re more flexible, generally offer more powerful options, and minimize processor use. mpg123 is one of those tools. With a simple command line interface, mpg123 can play your mp3 files in any order and with a multitude of options. To use mpg123, I usually do the following:

    cd /win/f/mp3/Blues
    mpg123 -vZ *.mp3

This command does several things in just a couple of lines of code. First, I change to the /win/f/mp3/70s directory, the place where all the music from my clear favorite genre is stored. Next, I execute mpg123 with the -v and -Z options. -v tells mpg123 to open in verbose mode. The output to the screen looks like this:

    Playing MPEG stream from Buddy Guy – Feels Like Rain.mp3 …
    MPEG 1.0, Layer: III, Freq: 44100, mode: Stereo, modext: 0, BPF : 0
    Channels: 2, copyright: Yes, original: Yes, CRC: No, emphasis: 0.
    Bitrate: 160 Kbits/s, Extension value: 0
    Audio: 1:1 conversion, rate: 44100, encoding: signed 16 bit, channels: 2
    Frame# 5736 [ 4165], Time 02:46:33 [01:29.11],

This is a summary of all relevant details of the file playing, along with a counter displaying the elapsed and remaining time.

The -Z option in the above command sets mpg123 to random mode within the current directory. In other words, it plays all the *.mp3 files in the directory in random order.

You can utilize mpg123 in even more interesting ways, using wildcards. For example, I can use the following commands …

    cd /win/f/mp3/60s
    mpg123 -vZ “Janis Joplin”*.mp3

… to randomly play only the Janis Joplin files in my mp3 directory. If I choose to move to the next random selection, it’s simply a matter of [ctrl-c]ing to kill the current selection and start the next. To kill the program altogether, use [ctrl c] twice in quick succession.

The sound quality produced by mpg123 easily rivals anything else in Linux, GUI or not. Using options found in the mpg123 –help command, you can also set the gain (volume), test, shuffle, send the output to a different audio device, and many other easy tricks.

mpg123 is another fine example both of multimedia in Linux and the power of the command line.