Search

MPD: The Music Player Daemon

March 14th, 2007 edited by Tincho

Entry submitted by Igor Stirbu. DPOTD needs your help, please contribute !

Music Player Daemon is a server that plays sound files and streams and can be controlled through remote clients. MPD supports Ogg-Vorbis, MP3, FLAC, Wave and AIFF for sound files and Ogg-Vorbis and MP3 for streams. Also has support for cross-fade.

MPD is a very flexible media player due to it’s client/server nature. MPD can be configured to use your sound card or interact with an icecast server and send the stream over the network. It can be controlled with clients that may reside on the same machine or all over the network.

When MPD starts, it reads first ~/.mpd.conf and then /etc/mpd.conf, if the former can’t be read. So it may be configured to run at startup or be started by any user. Here is the content of my .mpd.conf file:

# ~/.mpdconf
music_directory     "/home/igor/media/mp3"
playlist_directory  "/home/igor/.mpd"

state_file      "/home/igor/.mpd/state_file"
db_file         "/home/igor/.mpd/tag_cache"
error_file      "/home/igor/.mpd/error_file"
log_file        "/home/igor/.mpd/log_file"
pid_file        "/home/igor/.mpd/pid_file"

mixer_type      "alsa"
mixer_device    "default"
mixer_control   "PCM" 

filesystem_charset  "UTF-8"

audio_output {
    type        "alsa"
    name        "Local sound card"
}

audio_output {
    type        "shout"
    name        "Icecast2 stream ( http://keo:8000/stream.ogg)"
    host        "keo"
    port        "8000"
    mount       "/stream.ogg"
    password    "hackme"
    # quality     "7.0"
    bitrate     "128"
    format      "44100:16:1"
    # Optional Paramters
    user        "source"
    description "All your music are belong to us"
    genre       "rock"
}

This setup allows me to directly use my sound card when working on the computer where MPD runs or enable the icecast stream and listen over the network when using the laptop.

The modifications to icecast.xml are these:

    <hostname>keo</hostname>
    <mount>/stream.ogg</mount>

Nice features for MPD are available due to it’s configuration files. If you specify a pid_file you can use mpd --kill to stop the daemon. The state_file saves the state of the player (i.e. the playlist, the time and the name of the current song, the enabled outputs, etc.) If stopped gracefully, it writes the state_file and when started, resumes playback and restores the playlist.

Visit MPD’s home page for more information regarding releases, clients, FAQ. Packages for MPD are available in Debian since Sarge, and in Ubuntu since Hoary.

Clients

In Debian a few clients are available for MPD and more of them listed on the MPD web page. The one I use is Gmpc. It supports notification area integration, pop-up notification, playlist manager, server settings panel. There are ncurses, command line, web and other types of clients.

In the following screenshot, you can see a bunch of clients connected to the same mpd daemon: gmpc, pympd, ncmpc (ncurses), and phpMp2 (web).

MPD clients screenshot

Posted in Debian, Ubuntu |

8 Responses

  1. Paul Kishimoto Says:

    Don’t forget Sonata! It’s hands-down better than Gmpc.

    http://sonata.berlios.de/

  2. Brett lee Says:

    the above site gives good description about Music Player Daemon is a server that plays sound files and streams and can be controlled through remote clients and i have gone through a site related to music player Daemon which gives sufficient information about MPD

    music

  3. Mike Says:

    A web client I also like:
    http://mroyer31.hd.free.fr/~roy/wiki/doku.php?id=ajaxmp

  4. cartruck Says:

    More apps should be built like this with a separation between daemon and front-end. It exemplifies Unix philosophy of modularization and doing one thing and one thing well.

    I’m dying for a torrent app that is just a back-end. (BTG is too buggy and doesn’t seem to be aiming for third-party front-ends.)

  5. koctep Says:

    Best client I’ve found is qmpdclient http://havtknut.tihlde.org/qmpdclient/

    It also has a deb repository, just put
    deb http://havtknut.tihlde.org/debian qmpdclient main
    in your sources.list, update and install

    mpd wiki: http://mpd.wikia.com/wiki/Main_Page

  6. Felix Says:

    Another Client/Server Music Player is XMMS2.
    See http://wiki.xmms2.xmms.se/index.php/Main_Page

  7. Michael Wojchiechowski Says:

    cartruck: I am dying to know why you just complain about BTG and do not use the bugtracker (http://developer.berlios.de/bugs/?group_id=3293) to add some of those bugs you found.

    Also, BTG uses XML-RPC and the list of commands the daemon accepts is not a secret. While it is not something that has any priority for me, I am adding additional commands when people want me to.

  8. ChristenDoc Says:

    cartruck: Take a look at mldonkey. It’s a fantastic backend. Frontends available are a little limited, but let me know what you think. opensourcedds @t gmail d0t com