While not the most innovative thing to do, getting your Linux command-line to play music can be useful in many situations. Perhaps you have a less-capable PC which you want to use as a simple media player, or you do not want to install a GUI just to listen to music. These players are also very useful in situations like car computers which might not have a suitable display to control them. Whatever the need, there are a bunch of audio players for Linux which will play music without needing to run a fancy interface and use lots of resources.
mpg123 is a fast command-line based audio player which works on most POSIX compliant operating systems, including Linux and UNIX. Since the audio decoder has been optimized using the Assembler programming language, it is probably the most resource-efficient audio player today. Here are a list of features advertised by mpg123:
- Support for many platforms (many Unices, MacOSX, Windows) and audio subsystems
- Simple but powerful control mode for frontends
- Realtime control of efficient equalizer
- Built-in terminal control keys
- Support for gapless playback of mp3 files
- Many audio data settings: resampling, choose channel, mono,
- Really efficient with a growing number of assembler optimizations
- Support for Relative Volume Adjustment / ReplayGain
To get mpg123 for your Linux distribution, look through your package manager’s repository. To use the application to play audio, just type: mpg123 “/path/to/audio/file/filename.mp3”
mp3blaster is another command line player which plays multiple formats like MP3, Ogg Vorbis, wav and sid. The ace up its sleeve is its ability to compose a very flexible playlist. In the creator’s own words, “I also wondered why all mp3players had such plain playlist functionality! I like the ability to chuck a bunch of CD’s in a multi-CD cd player, and then play the CD’s in random order. In such a way that the cd player selects one of the five CD’s at random, and then plays the entire disc. This continues, until all discs have been played. No mp3 player could do this, so I decided to add it to mine. "
It has an ncurses interface which gives users the ability to interact and control the player while music is playing. mp3blaster can be installed in your Linux distribution by referring to its package manager. To run mp3blaster, type “mp3blaster” in the command-line, then control the player using the keys mentioned in the user interface itself.
Although mplayer is a lot more than a command-line audio player, it works just as well as any other dedicated command-line audio player. It works on all major operating systems including UNIX, Linux and Windows. It supports the following audio file formats:
- Intel Music Coder
- Monkey’s Audio
Playing an audio file in mplayer is as simple as typing “mplayer /path/to/audio/file/song.mp3”. Various keyboard shortcuts are available to navigate and control the playback of files. Refer to mplayer’s documentation to find out more. mplayer will be available in your Linux distribution’s package manager. Please refer to your distribution’s documentation to install mplayer.
Command-line audio players, while not having the fancy graphical interfaces of their GUI counterparts, are very useful in certain situations. These players shine on computers with less horsepower and specific purposes. For example, you could use an old computer with loads of storage space using multiple hard-disks and make it an audio player using one of these minimalistic players.