MPD (Music Player Daemon): Complete guide to enjoy your music on Linux

Introduction to MPD

MPD, or Music Player Daemon, is a music playback server that runs in the background and allows playback control via various clients. Its client‑server architecture separates the decoding and audio output logic from the user interface, making it ideal for headless environments, embedded systems, or simply for anyone seeking a lightweight and flexible solution. Being based on Linux, MPD supports a wide variety of audio formats, from MP3 and FLAC to Ogg Vorbis and WAV, and can send sound to ALSA, PulseAudio, Jack, or even to network outputs such as HTTP or Icecast.

Installation on popular distributions

In most Linux distributions, MPD is available in the official repositories. On Ubuntu or Debian you just need to run sudo apt update && sudo apt install mpd. On Fedora use sudo dnf install mpd, while on Arch Linux the package is found in sudo pacman -S mpd. After installation, the service can be started with sudo systemctl start mpd and enabled for boot with sudo systemctl enable mpd. It is advisable to review the configuration file located at /etc/mpd.conf before starting the daemon to adjust paths and permissions according to the user’s needs.

Basic daemon configuration

The mpd.conf file contains sections such as music_directory, which indicates where the music library is located, and bind_to_address, which defines on which interface the daemon listens (default localhost). Other important directives are port (TCP port, normally 6600), audio_output (to choose the output method) and permissions (to control who can connect). A simple example of an output section could be:

  • audio_output {
    type "alsa"
    name "My ALSA output"
    }
  • audio_output {
    type "pulse"
    name "PulseAudio output"
    }

After editing the file, reload the configuration with sudo systemctl restart mpd or send the HUP signal to the process.

Music library management

MPD does not automatically manage files; it relies on an index that is created or updated with the command mpc update. This process walks the directory specified in music_directory and builds an internal database that enables fast searches. Periodic updates can be scheduled via cron or by using the auto_update option in the configuration file, which watches for filesystem changes and updates the index in real time. Moreover, MPD allows creating playlists (playlists) stored in /var/lib/mpd/playlists or in any path indicated by playlist_directory. These lists can be in M3U or XSPF format and are manipulated via the client or directly with mpc load and mpc save.

Most popular clients to control MPD

The true strength of MPD lies in the variety of clients available, ranging from command‑line interfaces to sophisticated graphical clients. Among console clients stand out mpc (the official client), ncmpcpp (with a rich ncurses interface and visualizations) and ympd (a lightweight web client). In the graphical environment, options such as Cantata, GMPC and Rompr offer cover art fetching, tag editing, and drag‑and‑drop of tracks. There are also clients for Android (MPDroid, M.A.L.P.) and iOS (MPomello), allowing music control from any device on the same network.

Advanced usage: sockets, plugins and extensions

Beyond basic playback, MPD supports simultaneous multiple outputs by defining several audio_output blocks. This allows, for example, sending the same stream to an ALSA output for local speakers and to an HTTP output for transmitting to other devices. Output plugins can include encoders such as ffmpeg for transmissions in Opus or AAC format. Likewise, MPD can integrate with home‑automation systems via its TCP socket API, accepting simple commands like “play”, “pause”, “next” and returning state in JSON or plain text. This feature makes it an ideal component for multi‑room audio systems or for integrating with voice assistants through middleware such as Node‑RED or Home Assistant.

Common troubleshooting

If the client cannot connect, first verify that the daemon is running with systemctl status mpd and that it is listening on the expected port (netstat -tlnp | grep 6600). Music file permissions may block access; ensure the user under which MPD runs (usually mpd) has read permission on the directories and files. In case of no sound, check the audio_output section and try a simpler output such as ALSA directly. The daemon logs, accessible via journalctl -u mpd, often provide valuable clues about decoding errors or configuration problems.

Conclusions and best practices

MPD remains a robust and versatile solution for anyone seeking a lightweight, highly configurable, cross‑platform music server thanks to its clients. Its daemon‑client separation allows it to adapt to scenarios ranging from a Raspberry Pi playing music in a living room to a dedicated server feeding multiple listening zones in an office. To get the most out of MPD, keep your library updated, use playlists to organize listening sessions, and explore multiple‑output options to create personalized audio experiences. With a proper configuration and a client that fits your workflow, MPD can become the silent but powerful heart of your musical ecosystem.

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 .