January 29, 2008

CLI audio players for Linux

Author: Razvan T. Coloja

What would life be without music? Given the proper codecs, in Linux you can play almost any digital audio format. Linux has many graphical applications that can do the job, such as Amarok, Rhythmbox, Audacious, and XMMS, all of which provide an intuitive user interface, playlist sorting, and various other options. But what if you want low resource usage so you can play tunes on aging hardware? Here are some alternative players for the Linux command line.

At the top of the list comes mp3blaster. Out of all the CLI audio players I worked with, mp3blaster was the most comprehensive and feature-full. It has an ncurses interface, and once you familiarize yourself with the keys you'll find it fairly easy to renounce other audio players.

You can navigate the interface with the arrow, Enter, and Backspace keys. F1 alternates between file and playlist mode. If you want to add songs to the playlist, enter file mode, select some audio files using the spacebar, then press F1 again to add them to the current playlist. Press F3 if you want to automatically select all files. F2 inverts the selection.

With the f key you can toggle the file display mode. You can be shown the full path of the files, just the filenames with the filesize on the left, or the ID3 tag. This is useful when you have deep subdirectories in your music collection and want to quickly locate a song.

Speaking of locating songs, search is done with the / key, and it's case sensitive. mp3blaster searches only by filename, but it automatically jumps to the file you're looking for as you type its name. Press the s key to sort the files alphabetically (case sensitive or case insensitive), by day (newest first or oldest first), or by filesize.

You say you want to listen to an online radio station? Press F7 and type or paste the URL in the text field.

Mp3blaster allows you to create specialized playlists called groups. If you want to sort your music according to genre, for instance, select all the files and directories you want to group and press F5 to add the files to an unnamed group. Press F5 again to set a name for the group.

With F6 and F7 you can toggle Repeat or Shuffle mode. Press C to clear the current playlist or F4 to save the playlist as an .LST file somewhere on your hard drive for later use.

Volume control is done by using the t key, which accesses the mixer. You can pause and browse through a song using the 1-6 keys and change the volume with < and >.

The best of the rest

Cplay is a front end that allows one to play audio files from the command line using sox, xmp, madplay, and other such CLI audio decoders and converters. The interface is much simpler than mp3blaster's and offers limited options. You alternate between file and playlist mode using the Tab key, and calibrate the volume using the 1-9 keys. In file list mode, use the t key to tag files and the a key to add the selected songs to the current playlist, or U to untag them. You can use Ctrl-s to search for files, or s to make a recursive search. As you can see, the keys are mapped intuitively: d stands for delete, m for move, w for write playlist. Overall, Cplay is a clean alternative to mp3blaster.

Yet another interesting CLI audio player is Cmus (C* Music Player). It too features an ncurses front end, but you'll have to do a little typing to get things done. When you open the application, the playlist will be empty. To add a music folder you'll have to type :add /path/to/folder. To search for a song, press /, type the name of the band or song, and keep pressing the n key until you find what you're looking for. You control playback volume with + and -.

MOC (Music On Console) also sports an ncurses front end. It offers a two-panel view similar to Midnight Commander, and can play audio formats that are supported by FFmpeg and installed codecs. It has a mixer and supports color themes. The best part about MOC is that you can listen to music, and if you decide to close the terminal application, the server will keep running in the background. You can relaunch the front end if you wish to switch to another song or alter the volume. You use the Tab key to switch between playlist and file view modes, and < and > to change the volume. Press T to go to the theme selection menu and choose one of the available color modes, then use the a key to add files to the empty playlist.

There are many other CLI audio players for Linux. MPlayer, for example, can play audio files from the command line. Music Player Daemon has many front ends but can also be used from the command line. Other notable apps that don't need a GUI are mpg123 and mpg321, mjs, jinamp, benmp3, xcplay, mcplay, and ncxmms. Choose the one that serves you best, and play that music loud!


  • Reviews
  • Graphics & Multimedia