Overview
Discover what makes Music Player Daemon powerful
Music Player Daemon (MPD) is a lightweight, client‑server audio playback engine written in C that exposes a robust text‑based protocol over TCP. The daemon handles decoding of common audio formats (MP3, FLAC, Ogg Vorbis, AAC, etc.) via external decoders and manages a database of metadata extracted from the music library. Clients—whether command‑line tools, web UIs, or mobile apps—communicate with the daemon using a simple request/response syntax that can be scripted or wrapped in higher‑level libraries. This separation of concerns makes MPD a compelling choice for developers building custom media servers or integrating audio playback into larger systems.
Language & Runtime
Database
Audio Backend
Networking
Overview
Music Player Daemon (MPD) is a lightweight, client‑server audio playback engine written in C that exposes a robust text‑based protocol over TCP. The daemon handles decoding of common audio formats (MP3, FLAC, Ogg Vorbis, AAC, etc.) via external decoders and manages a database of metadata extracted from the music library. Clients—whether command‑line tools, web UIs, or mobile apps—communicate with the daemon using a simple request/response syntax that can be scripted or wrapped in higher‑level libraries. This separation of concerns makes MPD a compelling choice for developers building custom media servers or integrating audio playback into larger systems.
Technical Stack
- Language & Runtime: C (POSIX compliant) with extensive use of
libeventfor event handling andlibcfor system calls. The codebase is modular, with components such as audio, database, protocol, and client layers. - Database: An on‑disk SQLite3 database stores tags, playlists, and state. MPD uses a custom query language that mirrors SQL but is tailored for music metadata filtering.
- Audio Backend: Supports ALSA, OSS, PulseAudio, JACK, and PipeWire. The daemon can stream directly to the host’s audio device or pipe output to other processes.
- Networking: Listens on a configurable TCP port (default 6600) and accepts multiple simultaneous client connections. All communication is line‑based, making it trivially parsable by scripts or networking libraries.
Core Capabilities & APIs
- Protocol: The MPD protocol is documented in detail, featuring commands such as
play,stop,next,prev,add,remove,listplaylist, andsearch. Each command returns structured key/value pairs, allowing developers to build rich UIs or automation scripts. - Event Notifications: MPD can push events (
player,playlist,update) to clients via theidlecommand, enabling real‑time UI updates without polling. - Scripting & Automation: Because the protocol is text‑based, any language with TCP socket support can act as a client. Existing libraries exist for Python (
python-mpd2), Node.js (node-mpd), Ruby, and Go. - Extensibility: Plugins can be written in C or dynamically loaded libraries, allowing developers to add new commands, audio effects, or integrate with external services (e.g., music metadata providers).
Deployment & Infrastructure
MPD is designed for self‑hosting on Linux, BSD, or macOS. It can run as a system service (systemd unit) or under Docker containers, with official images available on Docker Hub. The daemon’s low memory footprint (≈30 MB RAM) and minimal CPU usage make it suitable for embedded devices like Raspberry Pi or home routers. For scalability, multiple MPD instances can be run behind a load balancer, each managing its own library. High‑availability is achievable with shared storage (NFS or Ceph) and a watchdog process to restart the daemon on failure.
Integration & Extensibility
- Plugins: The plugin API exposes hooks for audio processing, metadata enrichment, and custom commands. Developers can ship plugins as shared objects (
.so) that MPD loads at runtime. - Webhooks: While MPD does not natively support webhooks, the
idleevent system can be wrapped in a small service that forwards events to HTTP endpoints. - REST/GraphQL: Third‑party projects (e.g.,
myMPD,mpd-web) provide RESTful or GraphQL layers on top of the protocol, allowing integration with modern web stacks. - Custom Clients: Because the protocol is simple, building a custom client in any language is straightforward. Developers can embed MPD control into home automation platforms, IoT devices, or music visualizers.
Developer Experience
The project’s documentation is split into a user guide and a developer manual, both hosted on Read the Docs. The protocol spec is concise yet exhaustive, enabling rapid prototyping. Community support is active through GitHub Discussions and an IRC channel on Libera.Chat, where contributors discuss API extensions and performance tuning. Licensing under GPLv2 ensures that any derivative work must remain open source, which aligns with many community‑driven projects.
Use Cases
- Home Media Servers: Combine MPD with a web UI (e.g.,
myMPD) to create a low‑overhead streaming server for local networks. - Embedded Audio Systems: Deploy MPD on a Raspberry Pi to serve as the audio backend for smart speakers or car infotainment systems.
- Automation & IoT: Control playback via scripts triggered by sensors or voice assistants (Alexa, Home Assistant) using the protocol.
- Custom Music Bots: Build Discord or Slack bots that stream music to users by issuing MPD commands from the bot’s backend.
Advantages
- Performance & Low Footprint: Native C implementation with minimal dependencies results in fast decoding and low memory usage.
- Flexibility: The text‑based protocol is language‑agnostic; developers can choose any stack.
- Extensibility: Plugin system and event notifications allow deep customization without modifying core code.
- Open Source & Community: GPLv2 licensing and an active community reduce vendor lock‑in and provide a wealth of third‑party tools.
- Scalability: Docker support and simple configuration make it easy to scale horizontally or integrate into larger orchestration platforms.
MPD’s combination of a lightweight core,
Open SourceReady to get started?
Join the community and start self-hosting Music Player Daemon today
Related Apps in other
Immich
Self‑hosted photo and video manager
Syncthing
Peer‑to‑peer file sync, no central server
Strapi
Open-source headless CMS for modern developers
reveal.js
Create stunning web‑based presentations with HTML, CSS and JavaScript
Stirling-PDF
Local web PDF editor with split, merge, convert and more
MinIO
Fast, S3-compatible object storage for AI and analytics
Weekly Views
Repository Health
Information
Explore More Apps
ghstats
Self-hosted data-analysis
Simple NixOS Mailserver
Self-hosted apis-services
EMQX
Scalable, secure MQTT platform for real‑time IoT data
Selfoss
Universal web‑based RSS reader and aggregator
Huly
All-in-one platform for team planning, chat, and virtual office
Wakapi
Track coding time with a lightweight, self-hosted backend