MPD: The Music Player Daemon
March 14th, 2007 edited by TinchoEntry 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).
Posted in Debian, Ubuntu | 8 Comments »