Rock Out with Your Console Out
Playing and managing your music in text mode.
Some of you probably have played audio files from the terminal with
one-line commands, such as play, or even used the command line to open
a playlist in a graphical music player. Command-line integration is one
of the many advantages of using Linux software. This is an introduction
for those who want the complete listening experience—browsing, managing
and playing music—without leaving the text console.
Thanks to the Ncurses (New Curses) widget library, developers can design text user interfaces (TUIs) to run in any terminal emulator. An Ncurses application interface is interactive and, depending on the application, can capture events from keystrokes as well as mouse movements and clicks. It looks and works much like a graphical user interface, except it's all ASCII—or perhaps ANSI, depending on your terminal. If you've used GNU Midnight Commander, Lynx or Mutt, you're already familiar with the splendors of Ncurses.
An intuitive interface, whether textual or graphical, is especially
important in a media player. No one wants to sift through a long man
page or resort to Ctrl-c just to stop an annoying song from
playing on repeat, and most users (I'm sure some exceptions exist among
Linux Journal readers) don't want to type out a series of commands just
to ls the songs in an album's directory, decide which one
you want to hear and play it, and then
play a
song in a different directory. If you've ever played music with a purely
command-line application, such as SoX, you know what I'm talking
about. Sure, a single command that plays a file is quite handy; this
article, however, focuses on TUI rather than CLI applications. For many
text-mode programs, Ncurses is the window (no pun intended) to usability.
Note to developers: if you want to write a console music player, take advantage of the Curses Development Kit (CDK), which includes several ready-made widgets, such as scrolling marquees and built-in file browsing.
Now, on to the music players!
Mp3blaster
Mp3blaster was the first console music player I ever used. That was in 2007, by which time it already was a mature and full-featured application. Its history actually dates back to 1997, before the mainstream really had embraced the MP3 format, let alone the idea of an attractive interface for controlling command-line music playback. Back then, it was humbly known as "Mp3player".
Despite the name, Mp3blaster supports several formats besides MP3s. Currently, these include OGG, WAV and SID. Keep an eye out for FLAC support in the future, as it is on the to-do list in the latest source tarball.
One nice feature of Mp3blaster is the top panel showing important keyboard shortcuts for playlist management. You can scroll through this list using + and -. There is also a useful chart on the right side that shows ASCII art playback symbols (such as |> for play) above their respective shortcut keys. Press ? for detailed help.
You can customize any of the keybindings in your configuration file, which is usually located at ~/.mp3blasterrc. I had to change several of these in order to use Mp3blaster in GNOME due to conflicts with my global hot keys. Mp3blaster's default keybindings are better suited for use without X.
Figure 1. A Playlist in Mp3blaster
Herrie
Herrie, meaning "clamour" in Dutch, was first released in 2006. Somehow it has escaped mention in many articles on console music players, but the Herrie community group on the music Web site Last.fm shows true fan dedication.
Herrie is great for Last.fm users because it's so easy to set up
track scrobbling. Most of the music players in this article support
scrobbling in some capacity—it's all open-source software, after all,
and in theory, you can write a script to make anything do
anything—but
configuration is exceptionally simple with Herrie. All you have to do
is put your user name and password in your ~/.herrie/config/herrie.conf
file. Note that the password should not be in plain text; rather, you
should type in the output of printf %s p4ssw0rd |
md5
as stated in the configuration file itself.
Figure 2. Herrie shows the current playlist on top and a file browser on the bottom.
MOC
Music on Console (MOC) is a good choice for music libraries that consist of OGG, WAV and MP3 files. It's easy to use out of the box, boasting a two-paned interface similar to that of Midnight Commander, with a file browser on the left and your playlist on the right. The default keybindings are intuitive—mostly single letters that stand for what they do, such as n for "next track" and R to toggle random play, so command-line newbies need not fear any Emacs-style digital acrobatics.
MOC is my go-to Linux music player these days. It's fast and slick, and it looks just how I want now that I've edited my ~/.moc/config file to adjust the colors and the widths of each window pane. Another plus is its support for the JACK Audio Connection Kit (JACK).
The command to start MOC is mocp.
Figure 3. My Customized MOC Layout
Emacs + Bongo/EMMS
If Emacs-style digital acrobatics are your modus operandi, check out Bongo and the Emacs Multi-Media System (EMMS). Both media players run inside Emacs and provide similar functionality. The main difference is that EMMS is designed to run unobtrusively in the background, while Bongo emphasizes the user interface.
Bongo and EMMS are written in Emacs Lisp. You can install them the same way you'd install any other Emacs package; this may vary from distro to distro, but no matter what operating system you're using, you'll probably end up editing some Lisp configuration files. One of the first things to configure is your list of back ends. These programs don't actually do the dirty work of playing your music files; rather, they are front ends for other programs.
You can link any back end of your choice to a file type as well as pass
custom command-line arguments. For example, one of the back ends
Bongo recognizes by default is mpg123. If you want it to use, say, mpg321
instead, it's just a matter of editing that line in your configuration
file or using Emacs to access Bongo's built-in customization dialog with
M-x customize-group RET bongo RET. You can add a custom
back end with a few lines such as these:
(define-bongo-backend mpg321
:pretty-name "MPG-Thr33-Tw0-0ne"
:extra-program-arguments '("--loop 0")
:matcher '(local-file "mp3" "wav"))
Although I use Emacs from time to time, I'm no guru; I admit that the
time I spent with Bongo was flustering. For instance, I pressed Return
to start playing a track—easy enough—but then realized I didn't know
how to turn it off. I entered M-x apropos RETURN
bongo and
read through the list of Bongo commands until I found the one I needed:
M-x bongo-stop. The GitHub home page reveals that
you also can
stop playback immediately with C-c C-s, and there are
other key combinations for fancier tricks, such as 3 C-c
C-s
to stop playback after the next three tracks finish playing.
That example is a fair representation of my whole experience with Bongo so far. It can be scary if you don't know your way around Emacs very well, but it's extremely powerful and full of options that you'd probably never thought of before.
If you're a Vi/Vim fanatic, consider Vimmpc and Vimp3.
Figure 4. An Emacs session with the Bongo player in the bottom window, Bongo's README in the top window and Emacs Code Browser (ECB) on the left side.
Rebecca "Ruji" Chapnik is a freelance creator of miscellanea, including but not limited to text and images. You can find her experiments at http://rujic.net
Today’s modular x86 servers are compute-centric, designed as a least common denominator to support a wide range of IT workloads. Those generic, virtualized IT workloads have much different resource optimization requirements than hyperscale and cloud applications. They have resulted in a “one size fits all” enterprise IT architecture that is not optimized for a specific set of IT workloads, and especially not emerging hyperscale workloads, such as web applications, big data, and object storage. In this report, you will learn how shifting the focus from traditional compute-centric IT architectures to an innovative disaggregated fabric-based architecture can optimize and scale your data center.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
| Non-Linux FOSS: Seashore | May 10, 2013 |
| Trying to Tame the Tablet | May 08, 2013 |
- Using Salt Stack and Vagrant for Drupal Development
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- New Products
- Validate an E-Mail Address with PHP, the Right Way
- Drupal Is a Framework: Why Everyone Needs to Understand This
- A Topic for Discussion - Open Source Feature-Richness?
- Home, My Backup Data Center
- New Products
- New Products
- RSS Feeds
- This is the easiest tutorial
5 hours 36 min ago - Ahh, the Koolaid.
11 hours 14 min ago - git-annex assistant
17 hours 14 min ago - direct cable connection
17 hours 36 min ago - Agreed on AirDroid. With my
17 hours 46 min ago - I just learned this
17 hours 51 min ago - enterprise
18 hours 21 min ago - not living upto the mobile revolution
21 hours 12 min ago - Deceptive Advertising and
21 hours 48 min ago - Let\'s declare that you have
21 hours 48 min ago
Enter to Win an Adafruit Prototyping Pi Plate Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Prototyping Pi Plate Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- Next winner announced on 5-21-13!
Free Webinar: Linux Backup and Recovery
Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.
In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.



Comments
+1 cmus; randomplay for random play
cmus for hassle free music. I just discovered randomplay looking for random number generators it the mint repos' and it is great. does what it says and remembers acroos sessions.
Reply to comment | Linux Journal
Your personal message emailed to 500,000 UNIQUE Prospects.
All interested in your service or product. These are not just your regular everyday emails.
The list members chose to join it by double-opting in. Most people have found that the list is highly responsive.
What more could you ask for? A one time personal-emailing to 500,000 UNIQUE Prospects is
just *$9.95. Purchase it now and we Will Boost The UNIQUE Prospects To 1,
500,000. We feel It will please you to know that we have
been an internationally recognized company for over twelve years.
You better hope you surf to our website before your competition does.
Dont Forget To Use Promo Code 233 For a Lifetime Global-Marketing Membership.
Start Success Now!
re
age of empicasres gcasuide
thanks!
Thanks Rebecca, wasn't aware these were out there, and that many of them.
I really prefer console in favor of GUI.
Maybe you can write an article on the excellent ffmpeg too?
Thanks again,
Michel
Somehow, nvlc passed me by.
Somehow, nvlc passed me by. Thanks for the tip. Now I don't have to pull my head out of the command line just to listen to music files.
Dave Keays, freelance webmaster
MOC
I have been using MOC with transparency for a long time. It is perfect.
+1 for cmus. Been using it
+1 for cmus. Been using it for years. very lightweight, to the point, without any bloat.
I am quite surprised that the author didn't know of cmus, as she has mentioned quite a few obscure ones.
Anyway, good article. It'll sure help a lot of people looking for console players.
Forgot CMUS
The author deserves credit for being quite thorough. Unfortunately, one of the omissions is a big one; to me, cmus is the best music player there is, holding its own against all other TUI, CLI, or GUI programs.
forgot about cplay
I've been using cplay for years,
https://github.com/holizz/cplay