The Music Player Daemon - User's ManualIntroduction
This document is work in progress. Most of it may be incomplete
yet. Please help!
MPD (Music Player Daemon) is, as the name suggests, a server
software allowing you to remotely play your music, handle
playlists, deliver music (HTTP STREAMS with various
sub-protocols) and organizze playlists.
It has been written with minimal resource usage and stability in
mind! Infact, it runs fine on a Pentium 75, allowing you to use
your cheap old PC to create a stereo system!
MPD supports also Gapless playback, buffered audio output, and
crossfading!
The separate client and server design allows users to choose a
user interface that best suites their tastes independently of
the underlying daemon, which actually plays music!
Installation
We recommend that you use the software installation routines of
your distribution to install MPD. Most operating systems have a
MPD package, which is very easy to install.
Installing on Debian/Ubuntu
Install the package mpd via APT:
apt-get install mpd
When installed this way, MPD by default looks for music in
/var/lib/mpd/music/; this may not be correct. Look at your
/etc/mpd.conf file...
Compiling from source
Download the source tarball from the MPD home
page and unpack it:
tar xf mpd-version.tar.xz
cd mpd-version
Make sure that all the required libraries and build tools are
installed. The INSTALL file has a list.
For example, the following installs a fairly complete list of
build dependencies on Debian Wheezy:
apt-get install g++ automake autoconf \
libmad0-dev libmpg123-dev libid3tag0-dev \
libflac-dev libvorbis-dev libopus-dev \
libadplug-dev libaudiofile-dev libsndfile1-dev libfaad-dev \
libfluidsynth-dev libgme-dev libmikmod2-dev libmodplug-dev \
libmpcdec-dev libwavpack-dev libwildmidi-dev \
libsidplay2-dev libsidutils-dev libresid-builder-dev \
libavcodec-dev libavformat-dev \
libmp3lame-dev \
libsamplerate0-dev \
libbz2-dev libcdio-paranoia-dev libiso9660-dev libmms-dev \
libzzip-dev \
libcurl4-gnutls-dev libyajl-dev \
libasound2-dev libao-dev libjack-jackd2-dev libopenal-dev \
libpulse-dev libroar-dev libshout3-dev \
libmpdclient-dev \
libavahi-client-dev \
libsqlite3-dev \
libsystemd-daemon-dev libwrap0-dev \
libcppunit-dev xmlto \
libglib2.0-dev
Now configure the source tree:
./configure
The --help argument shows a list of
compile-time options. When everything is ready and
configured, compile:
make
And install:
make installsystemd socket activation
Using systemd, you can launch
mpd on demand when the first client
attempts to connect. Create two files in
/etc/systemd/system/; first
mpd.socket:
[Socket]
ListenStream=/run/mpd.socket
ListenStream=6600
[Install]
WantedBy=sockets.target
Now create mpd.service:
[Unit]
Description=Music Player Daemon
After=sound.target
[Service]
ExecStart=/usr/bin/mpd --stdout --no-daemon
Start the socket:
systemctl enable mpd.socket
systemctl start mpd.socket
In this configuration, mpd will ignore
the bind_to_address and
port settings.
ConfigurationConfiguring the music directory
When you play local files, you should organize them within a
directory called the "music directory". This is configured in
MPD with the music_directory setting.
By default, MPD follows symbolic links in the music directory.
This behavior can be switched off:
follow_outside_symlinks controls whether
MPD follows links pointing to files outside of the music
directory, and follow_inside_symlinks lets
you disable symlinks to files inside the music directory.
Configuring database plugins
If a music directory is configured, one database plugin is
used. To configure this plugin, add a
database block to
mpd.conf:
database {
plugin "simple"
path "/var/lib/mpd/db"
}
The following table lists the database
options valid for all plugins:
Name
Description
plugin
The name of the plugin.
Configuring input plugins
To configure an input plugin, add a input
block to mpd.conf:
input {
plugin "despotify"
user "foo"
password "bar"
}
The following table lists the input options
valid for all plugins:
Name
Description
plugin
The name of the plugin.
enabledyes|no
Allows you to disable a input plugin without
recompiling. By default, all plugins are enabled.
Configuring decoder plugins
Most decoder plugins do not need any special configuration.
To configure a decoder, add a decoder block
to mpd.conf:
decoder {
plugin "wildmidi"
config_file "/etc/timidity/timidity.cfg"
}
The following table lists the decoder
options valid for all plugins:
Name
Description
plugin
The name of the plugin.
enabledyes|no
Allows you to disable a decoder plugin without
recompiling. By default, all plugins are enabled.
Configuring encoder plugins
Encoders are used by some of the output plugins (such as
shout). The encoder settings are included
in the audio_output section.
Configuring audio outputs
Audio outputs are devices which actually play the audio chunks
produced by MPD. You can configure any number of audio output
devices, but there must be at least one. If none is
configured, MPD attempts to auto-detect. Usually, this works
quite well with ALSA, OSS and on Mac OS X.
To configure an audio output manually, add an
audio_output block to
mpd.conf:
audio_output {
type "alsa"
name "my ALSA device"
device "hw:0"
}
The following table lists the audio_output
options valid for all plugins:
Name
Description
type
The name of the plugin.
name
The name of the audio output. It is visible to the
client. Some plugins also use it internally, e.g. as
a name registered in the PULSE server.
format
Always open the audio output with the specified audio
format (samplerate:bits:channels), regardless of the
format of the input file. This is optional for most
plugins.
Any of the three attributes may be an asterisk to
specify that this attribute should not be enforced,
example: 48000:16:*.
*:*:* is equal to not having
a format specification.
The following values are valid for
bits: 8
(signed 8 bit integer samples),
16, 24 (signed
24 bit integer samples padded to 32 bit),
32 (signed 32 bit integer
samples), f (32 bit floating
point, -1.0 to 1.0).
enabledyes|no
Specifies whether this audio output is enabled when
MPD is started. By default, all audio outputs are
enabled.
tagsyes|no
If set to "no", then MPD will not send tags to this
output. This is only useful for output plugins that
can receive tags, for example the
httpd output plugin.
always_onyes|no
If set to "yes", then MPD attempts to keep this audio
output always open. This may be useful for streaming
servers, when you don't want to disconnect all
listeners even when playback is accidentally stopped.
mixer_typehardware|software|none
Specifies which mixer should be used for this audio
output: the hardware mixer (available for ALSA, OSS
and PulseAudio), the software mixer or no mixer
("none"). By default, the hardware mixer is used for
devices which support it, and none for the others.
replay_gain_handlersoftware|mixer|none
Specifies how replay gain is applied. The default is
"software", which uses an internal software volume
control. "mixer" uses the configured (hardware) mixer
control. "none" disables replay gain on this audio
output.
Configuring filters
Filters are plugins which modify an audio stream.
To configure a filter, add a filter block
to mpd.conf:
filter {
plugin "volume"
name "software volume"
}
The following table lists the filter
options valid for all plugins:
Name
Description
plugin
The name of the plugin.
name
The name of the filter.
Configuring playlist plugins
Playlist plugins are used to load remote playlists. This is
not related to MPD's playlist directory.
To configure a playlist plugin, add a
playlist_plugin block to
mpd.conf:
playlist_plugin {
name "m3u"
enabled "true"
}
The following table lists the
playlist_plugin options valid for all
plugins:
Name
Description
name
The name of the plugin.
enabledyes|no
Allows you to disable a input plugin without
recompiling. By default, all plugins are enabled.
Audio Format SettingsGlobal Audio Format
The setting audio_output_format forces
MPD to use one audio format for all outputs. Doing that is
usually not a good idea. The values are the same as in
format in the
audio_output section.
Resampler
Sometimes, music needs to be resampled before it can be
played; for example, CDs use a sample rate of 44,100 Hz
while many cheap audio chips can only handle 48,000 Hz.
Resampling reduces the quality and consumes a lot of CPU.
There are different options, some of them optimized for high
quality and others for low CPU usage, but you can't have
both at the same time. Often, the resampler is the
component that is responsible for most of MPD's CPU usage.
Since MPD comes with high quality defaults, it may appear
that MPD consumes more CPU than other software.
The following resamplers are available (if enabled at
compile time):
libsamplerate
a.k.a. Secret Rabbit Code (SRC).
libsoxr,
the SoX Resampler library
internal: low CPU usage, but very poor quality. This is
the fallback if MPD was compiled without an external
resampler.
The setting samplerate_converter controls
how MPD shall resample music. Possible values:
Value
Description
"internal"
The internal resampler. Low CPU usage, but very
poor quality.
"soxr very high"
Use libsoxr with "Very High Quality" setting.
"soxr high" or
"soxr"
Use libsoxr with "High Quality" setting.
"soxr medium"
Use libsoxr with "Medium Quality" setting.
"soxr low"
Use libsoxr with "Low Quality" setting.
"soxr quick"
Use libsoxr with "Quick" setting.
"Best Sinc Interpolator" or
"0"
libsamplerate: Band limited sinc interpolation, best
quality, 97dB SNR, 96% BW.
"Medium Sinc Interpolator" or
"1"
libsamplerate: Band limited sinc interpolation,
medium quality, 97dB SNR, 90% BW.
"Fastest Sinc Interpolator" or
"2"
libsamplerate: Band limited sinc interpolation,
fastest, 97dB SNR, 80% BW.
"ZOH Sinc Interpolator" or
"3"
libsamplerate: Zero order hold interpolator, very
fast, very poor quality with audible distortions.
"Linear Interpolator" or
"4"
libsamplerate: Linear interpolator, very fast, poor
quality.
Using MPDThe client
After you have installed, configured and started MPD, you
choose a client to control the playback.
The most basic client is mpc, which
provides a command line interface. It is useful in shell
scripts. Many people bind specific mpc
commands to hotkeys.
The MPD
Wiki contains an extensive list of clients to choose
from.
The music directory and the database
The "music directory" is where you store your music files.
MPD stores all relevant meta information about all songs in
its "database". Whenever you add, modify or remove songs in
the music directory, you have to update the database, for
example with mpc:
mpc update
Depending on the size of your music collection and the speed
of the storage, this can take a while.
To exclude a file from the update, create a file called
.mpdignore in its parent directory. Each
line of that file may contain a list of shell wildcards.
The queue
The queue (sometimes called "current playlist") is a list of
songs to be played by MPD. To play a song, add it to the
queue and start playback. Most clients offer an interface to
edit the queue.
Plugin referenceDatabase pluginssimple
The default plugin. Stores a copy of the database in
memory. A file is used for permanent storage.
SettingDescriptionpath
The path of the database file.
proxy
Provides access to the database of another MPD instance
using libmpdclient. This is useful
when you run mount the music directory via NFS/SMB, and the
file server already runs a MPD instance. Only the file
server needs to update the database.
SettingDescriptionhost
The host name of the "master" MPD instance.
port
The port number of the "master" MPD instance.
upnp
Provides access to UPnP media servers.
Input pluginscurl
Opens remote files or streams over HTTP.
SettingDescriptionproxy
Sets the address of the HTTP proxy server.
proxy_user,
proxy_password
Configures proxy authentication.
file
Opens local files.
mms
Plays streams with the MMS protocol.
cdio_paranoia
Plays audio CDs. The URI has the form:
"cdda://[DEVICE][/TRACK]". The
simplest form cdda:// plays the whole
disc in the default drive.
SettingDescriptiondefault_byte_orderlittle_endian|big_endian
If the CD drive does not specify a byte order, MPD
assumes it is the CPU's native byte order. This
setting allows overriding this.
despotify
Plays Spotify tracks using the despotify
library. The despotify plugin uses a spt:// URI and a Spotify
URL. So for example, you can add a song with:
mpc add spt://spotify:track:5qENVY0YEdZ7fiuOax70x1
You need a Spotify premium account to use this plugin, and you need
to setup username and password in the configuration file. The
configuration settings are global since the despotify playlist plugin
use the same settings.
SettingDescriptiondespotify_user
Sets up the Spotify username (required)
despotify_password
Sets up the Spotify password (required)
despotify_high_bitrate
Set up if high bitrate should be used for Spotify tunes.
High bitrate sounds better but slow systems can have problems
with playback (default yes).
smbclient
Allows MPD to access files on SMB/CIFS servers (e.g. Samba
or Microsoft Windows). All URIs with the
smb:// scheme are used. Example:
mpc add smb://servername/sharename/filename.oggalsa
Allows MPD on Linux to play audio directly from a soundcard using
the scheme alsa://. Audio is formatted as
44.1 kHz 16-bit stereo (CD format). Examples:
mpc add alsa:// plays audio from device hw:0,0
mpc add alsa://hw:1,0 plays audio from device
hw:1,0
Decoder pluginsdsdiff
Decodes DFF files containing DSDIFF data (e.g. SACD rips).
SettingDescriptionlsbitfirstyes|no
Decode the least significant bit first. Default is
"no".
dsf
Decodes DSF files containing DSDIFF data (e.g. SACD rips).
fluidsynth
MIDI decoder based on libfluidsynth.
SettingDescriptionsample_rate
The sample rate that shall be synthesized by the
plugin. Defaults to 48000.
soundfont
The absolute path of the soundfont file. Defaults
to
/usr/share/sounds/sf2/FluidR3_GM.sf2.
mikmod
Module player based on MikMod.
SettingDescriptionloopyes|no
Allow backward loops in modules. Default is
no.
sample_rate
Sets the sample rate generated by
libmikmod. Default is 44100.
modplug
Module player based on MODPlug.
SettingDescriptionloop_count
Number of times to loop the module if it uses backward loops.
Default is 0 which prevents looping.
-1 loops forever.
wildmidi
MIDI decoder based on libwildmidi.
SettingDescriptionconfig_file
The absolute path of the timidity config file. Defaults
to
/etc/timidity/timidity.cfg.
Encoder pluginsflac
Encodes into FLAC (lossless).
SettingDescriptioncompression
Sets the libFLAC compression
level. The levels range from 0 (fastest, least
compression) to 8 (slowest, most compression).
lame
Encodes into MP3 using the LAME library.
SettingDescriptionquality
Sets the quality for VBR. 0 is the highest quality,
9 is the lowest quality. Cannot be used with
bitrate.
bitrate
Sets the bit rate in kilobit per second. Cannot be
used with quality.
null
Does not encode anything, passes the input PCM data as-is.
shine
Encodes into MP3 using the shine library.
SettingDescriptionbitrate
Sets the bit rate in kilobit per second.
twolame
Encodes into MP2 using the twolame
library.
SettingDescriptionquality
Sets the quality for VBR. 0 is the highest quality,
9 is the lowest quality. Cannot be used with
bitrate.
bitrate
Sets the bit rate in kilobit per second. Cannot be
used with quality.
vorbis
Encodes into Ogg Vorbis.
SettingDescriptionquality
Sets the quality for VBR. -1 is the lowest quality,
10 is the highest quality. Cannot be used with
bitrate.
bitrate
Sets the bit rate in kilobit per second. Cannot be
used with quality.
wave
Encodes into WAV (lossless).
Output pluginsalsa
The "Advanced Linux Sound Architecture" plugin uses
libasound. It is recommended if you
are using Linux.
SettingDescriptiondeviceNAME
Sets the device which should be used. This can be
any valid ALSA device name. The default value is
"default", which makes
libasound choose a device. It
is recommended to use a "hw" or "plughw" device,
because otherwise, libasound
automatically enables "dmix", which has major
disadvantages (fixed sample rate, poor resampler,
...).
use_mmapyes|no
If set to yes, then
libasound will try to use
memory mapped I/O.
buffer_timeUS
Sets the device's buffer time in microseconds.
Don't change unless you know what you're doing.
period_timeUS
Sets the device's period time in microseconds.
Don't change unless you really know what you're
doing.
auto_resampleyes|no
If set to no, then
libasound will not attempt to
resample, handing the responsibility over to MPD.
It is recommended to let MPD resample (with
libsamplerate), because ALSA is quite poor at doing
so.
auto_channelsyes|no
If set to no, then
libasound will not attempt to
convert between different channel numbers.
auto_formatyes|no
If set to no, then
libasound will not attempt to
convert between different sample formats (16 bit, 24
bit, floating point, ...).
dsd_usbyes|no
If set to yes, then DSD over
USB according to the pro
posed standard by dCS and others is enabled. This wraps
DSD samples in fake 24 bit PCM, and is understood by
some DSD capable products, but may be harmful to
other hardware. Therefore, the default is
no and you can enable the
option at your own risk.
ao
The ao plugin uses the portable
libao library.
SettingDescriptiondriverD
The libao driver to use for
audio output. Possible values depend on what libao
drivers are available. See http://www.xiph.org/ao/doc/drivers.html
for information on some commonly used drivers.
Typical values for Linux include "oss" and "alsa09".
The default is "default", which causes libao to
select an appropriate plugin.
optionsO
Options to pass to the selected
libao driver.
write_sizeO
This specifies how many bytes to write to the audio
device at once. This parameter is to work around a
bug in older versions of libao on sound cards with
very small buffers. The default is 1024.
fifo
The fifo plugin writes raw PCM data to a
FIFO (First In, First Out) file. The data can be read by
another program.
SettingDescriptionpathP
This specifies the path of the FIFO to write to.
Must be an absolute path. If the path does not
exist, it will be created when MPD is started, and
removed when MPD is stopped. The FIFO will be
created with the same user and group as MPD is
running as. Default permissions can be modified by
using the builtin shell command "umask". If a FIFO
already exists at the specified path it will be
reused, and will not be removed when MPD is stopped.
You can use the "mkfifo" command to create this, and
then you may modify the permissions to your liking.
jack
The jack plugin connects to a JACK
server.
SettingDescriptionclient_nameNAME
The name of the JACK client. Defaults to "Music
Player Daemon".
server_nameNAME
Optional name of the JACK server.
autostartyes|no
If set to yes, then
libjack will automatically
launch the JACK daemon. Disabled by default.
source_portsA,B
The names of the JACK source ports to be created.
By default, the ports "left" and "right" are
created. To use more ports, you have to tweak this
option.
destination_portsA,B
The names of the JACK destination ports to connect to.
ringbuffer_sizeNBYTES
Sets the size of the ring buffer for each channel.
Do not configure this value unless you know what
you're doing.
httpd
The httpd plugin creates a HTTP server,
similar to ShoutCast / IceCast. HTTP streaming clients like
mplayer can connect to it.
You must configure either quality or
bitrate. It is highly recommended to
configure a fixed format, because a
stream cannot switch its audio format on-the-fly when the
song changes.
SettingDescriptionportP
Binds the HTTP server to the specified port.
bind_to_addressADDR
Binds the HTTP server to the specified address (IPv4 or
IPv6). Multiple addresses in parallel are not supported.
encoderNAME
Chooses an encoder plugin,
e.g. vorbis.
qualityQ
Configures the encoder quality (for VBR) in the
range -1 .. 10.
bitrateBR
Sets a constant encoder bit rate, in kilobit per
second.
max_clientsMC
Sets a limit, number of concurrent clients. When set
to 0 no limit will apply.
null
The null plugin does nothing. It
discards everything sent to it.
SettingDescriptionsyncyes|no
If set to no, then the timer
is disabled - the device will accept PCM chunks at
arbitrary rate (useful for benchmarking). The
default behaviour is to play in real time.
oss
The "Open Sound System" plugin is supported on most Unix
platforms.
SettingDescriptiondevicePATH
Sets the path of the PCM device. If not specified,
then MPD will attempt to open
/dev/sound/dsp and
/dev/dsp.
openal
The "OpenAL" plugin uses libopenal.
It is supported on many platforms.
SettingDescriptiondeviceNAME
Sets the device which should be used. This can be
any valid OpenAL device name. If not specified, then
libopenal will choose a default device.
osx
The "Mac OS X" plugin uses Apple's CoreAudio API.
pipe
The pipe plugin starts a program and
writes raw PCM data into its standard input.
SettingDescriptioncommandCMD
This command is invoked with the shell.
pulse
The pulse plugin connects to a PulseAudio
server.
SettingDescriptionserverHOSTNAME
Sets the host name of the PulseAudio server. By
default, MPD connects to the local PulseAudio
server.
sinkNAME
Specifies the name of the PulseAudio sink MPD should
play on.
recorder
The recorder plugin writes the audio
played by MPD to a file. This may be useful for recording
radio streams.
You must configure either quality or
bitrate.
SettingDescriptionpathP
Write to this file.
encoderNAME
Chooses an encoder plugin,
e.g. vorbis.
qualityQ
Configures the encoder quality (for VBR) in the
range -1 .. 10.
bitrateBR
Sets a constant encoder bit rate, in kilobit per
second.
shout
The shout plugin connects to a ShoutCast
or IceCast server. It forwards tags to this server.
You must set a format.
SettingDescriptionhostHOSTNAME
Sets the host name of the Shoutcast/Icecast server.
portPORTNUMBER
Connect to this port number on the specified host.
timeoutSECONDS
Set the timeout for the shout connection in seconds.
Defaults to 2 seconds.
protocolicecast2|icecast1|shoutcast
Specifies the protocol that wil be used to connect
to the icecast/shoutcast server. The default
is "icecast2".
mountURI
Mounts the MPD stream in the specified URI.
userUSERNAME
Sets the user name for submitting the stream to the
server. Default is "source".
passwordPWD
Sets the password for submitting the stream to the
server.
nameNAME
Sets the name of the stream.
genreGENRE
Sets the genre of the stream (optional).
descriptionDESCRIPTION
Sets a short description of the stream (optional).
urlURL
Sets a URL associated with the stream (optional).
publicyes|no
Specifies whether the stream should be "public".
Default is "no".
encoderPLUGIN
Sets the name of the encoder plugin. Default is
"vorbis". "vorbis" and "lame" are valid encoder
plugins (provided that you enabled them at compile
time).
solaris
The "Solaris" plugin runs only on SUN Solaris, and plays via
/dev/audio.
SettingDescriptiondevicePATH
Sets the path of the audio device, defaults to
/dev/audio.
Playlist pluginsembcue
Reads CUE sheets from the "CUESHEET" tag of song files.
m3u
Reads .m3u playlist files.
extm3u
Reads extended .m3u playlist files.
pls
Reads .pls playlist files.
xspf
Reads XSPF
playlist files.
despotify
Adds Spotify
playlists. Spotify playlists use the spt:// URI,
and a Spotify playlist URL. So for example, you can load a playlist
with
mpc load spt://spotify:user:simon.kagstrom:playlist:3SUwkOe5VbVHysZcidEZtH
See the despotify input plugin for configuration options (username
and password needs to be setup)
soundcloud
Adds Soundcloud
playlists. SoundCloud playlists use the soundcloud:// URI,
and with a number of arguments, you may load different playlists with
mpc load soundcloud://track/TRACK_ID
mpc load soundcloud://playlist/PLAYLIST_ID
mpc load soundcloud://user/USERNAME
mpc load soundcloud://search/SEARCH_QUERY
mpc load soundcloud://url/https://soundcloud.com/ARTIST/TRACK-NAME
SettingDescriptionapikeyclient_id
User apikey/client_id can override the MPD token provided by SoundCloud.