MOC (Music on Console): Lightweight music player for the terminal

Introduction

In the world of free software, finding tools that consume few resources and offer a complete experience is always an advantage. MOC (Music on Console) is an audio player designed exclusively to run in the terminal, ideal for servers, old computers, or users who prefer to work without heavy graphical environments. Its ncurses-based interface allows navigating folders, creating playlists, and controlling playback with intuitive keys, all while maintaining a CPU and memory consumption that is practically negligible.

What is MOC?

MOC is a text-mode music player that supports a wide variety of formats such as MP3, Ogg Vorbis, FLAC, WAV, and more, thanks to the decoding libraries of FFmpeg or libmad. It consists of two parts: the daemon mocp that manages playback in the background and the interface client that is launched with the same command. This architecture allows closing the terminal window without stopping the music, as the process continues running in the background.

Installation on Linux Distributions

  • Ubuntu/Debian: sudo apt-get update && sudo apt-get install moc
  • Fedora: sudo dnf install moc
  • Arch Linux: sudo pacman -S moc
  • OpenSUSE: sudo zypper install moc

After installation, the service does not start automatically; simply run mocp in any terminal to launch both the daemon and the interface.

Basic Configuration

The configuration file is located at ~/.moc/config. There you can adjust options such as the default music directory, the color theme, the behavior when reaching the end of a playlist, and the use of an equalizer. For example, to set the music folder to ~/Música and enable the dark theme, just add the lines:
MusicDir = "~/Música"
Theme = "dark_background"
Then, save the file and restart mocp for the changes to take effect.

Daily Use: Essential Commands

  • Launch the player: mocp
  • Navigate folders: use the up/down arrows to move and Enter to enter a directory or play a file.
  • Playback control: Space pause/resume, n next track, b previous, s stop.
  • Create playlist: press a to add the current item to the play queue, C to clear it.
  • Exit without stopping music: press q; playback will continue in the background and can be reopened with another mocp.

Advanced Features

  • Format support: in addition to the standard ones, MOC can read AAC, M4A, WMA, and FLAC files via the codecs installed on the system.
  • Themes and colors: several predefined themes exist (for example, dark_background, transparent_background) and you can create your own by modifying the color values in the configuration file.
  • Integration with scripts: using the server mode (mocp -S) you can send commands via mocp -p (play), mocp -g (next) or mocp -t (toggle) from any bash script or external application.
  • Equalizer and effects: you can enable a 10-band equalizer via the option Equalizer = "yes" and adjust bands using Eq1 through Eq10.
  • Lyrics and metadata: with the lyrics plugin (available in some repositories) MOC displays the current song’s lyrics in real time.

Advantages Over Other Players

Compared to graphical players like Clementine, Rhythmbox, or VLC, MOC stands out for its low resource consumption, making it perfect for machines with limited hardware or for remote work sessions via SSH. Its reliance on only ncurses and audio decoding libraries eliminates the need to load full graphical environments, reducing the attack surface and improving stability. Moreover, the ability to control playback via command-line commands facilitates automation, integration with tiling window managers, and use in embedded systems such as Raspberry Pi.

Conclusion

MOC demonstrates that power does not always need a flashy interface; sometimes efficiency and simplicity are the best virtues of a software. If you are looking for a music player that is fast, configurable, and works without issues in any terminal environment, MOC is an option worth trying. Just install, set up your music folder, and let the terminal become your audio entertainment center.

This post is also available in ESPAÑOL.

Leave a Reply

Your email address will not be published. Required fields are marked *

Esta obra está bajo una Licencia Creative Commons Atribución 4.0 Internacional para Francesc Roig francesc@vivaldi.net .