Note: this wiki is no longer maintained. If you have any questions related to this wiki, please post them on the CrunchBang forums.

Translations of this page?:

AUDIO MPD (Music Player Daemon) Installation & Configuration Guide

Music Player Daemon (MPD) is a flexible, powerful, server-side application for playing music. Through plugins and libraries it can play a variety of sound files while being controlled by its network protocol.


First of all install MPD: apt-get install mpd It's recommended to install mpc too: apt-get install mpc Mpc is a command line based client for MPD that should help you to control it without any special GUI client.

Setting up the daemon

Set up MPD as user service and prevent it to start as a system daemon: sudo service mpd stop and
sudo update-rc.d mpd disable

Creating the configuration files

Now we will make a new directory in the home folder for the configuration files of MPD and the playlists:

mkdir -p ~/.mpd/playlists

Copy the configuration file to our home folder:

gunzip -c /usr/share/doc/mpd/examples/mpd.conf.gz > ~/.mpd/mpd.conf

And now we will create all the needed files for it:

touch ~/.mpd/{mpd.db,mpd.log,,mpdstate}

Editing the configuration files

Now is the time when we will actually edit the MPD configuration file. Use your editor of choice:

geany ~/.mpd/mpd.conf

Enter your home directory and your user name. The music_directory has to point to the music folder:

music_directory        "/media/David Extern/Música"

playlist_directory     "/home/david/.mpd/playlists"

db_file            "/home/david/.mpd/tag_cache"

log_file        "/home/david/.mpd/mpd.log"

pid_file        "/home/david/.mpd/"

state_file        "/home/david/.mpd/mpdstate"

Comment the line which starts with user:

#user                "mpd"

The second important thing is your sound output. To use Alsa, edit the section:

audio_output {
    type        "alsa"
    name        "My ALSA Device"
    device        "hw:0,0"    # optional
    format        "44100:16:2"    # optional
    mixer_device    "default"    # optional
    mixer_control    "PCM"        # optional
    mixer_index    "0"        # optional

But if you use Pulse, you have to comment the Alsa section and go to the Pulse section and it has to look like this:

audio_output {
  type    "pulse"
  name    "MPD"                                                                 
# server    "remote_server"   # optional
# sink    "remote_server_sink"  # optional

Save the file and close your editor.

Start-up and import

To start MPD just type: mpd It should automatically add all your music to your music directory, if not type: mpc update MPD will now take some time and import all your music but it is doing it rather fast.

Now we will create a desktop file to start MPD automatically on boot:
geany ~/.config/autostart/mpd.desktop
Add these lines:

[Desktop Entry]
Name=Music Player Daemon
Comment=Server for playing audio files

Now MPD will start always as a daemon in the background on boot. It will also run as your user and not as root.

Advanced options

You can of course change some settings to your personal likings in the MPD configuration file.

users of Waldorf/Debian Wheezy/Debian Sid can change the auto_update function:

#auto_update    "yes"

To prevent interference with other applications' volume settings, enable:

mixer_type            "software"

You can set up replay gain with MPD, a great feature some music apps in Linux does not offer:

replaygain            "track"

Gapless playback can be enabled with:

gapless_mp3_playback            "yes"

Clients/Front-ends for mpd

These clients are available in Debian's repository:

ncmpc - An excellent curses based MPD client ncmpcpp - A concept fork of ncmpc written in C++ (popular pick!) ncmpy - A [Python + Curses]-based MPD client pms - A feature-rich and highly configurable ncurses based client with commands similar to vim Ario - A light and complete GTK2 client that runs on Linux and Windows gbemol - A GTK+ client with a nice library browser gmpc - Gnome Music Player Client - A fully featured, low on resources player Gimmix - A graphical MPD client written in C using GTK+2 sonata - A lightweight GTK+ client written in Python Glurp - A small GTK+ client written in C

Install the client of your choice, for example ncmpcpp

sudo apt-get install ncmpcpp

Extra sound options (Debian Testing/Unstable)

mpd itself does not feature an equalizer, however it is possible to add Alsaequal.

This is only for Testing/Unstable users. If you want to install alsaequal on Stable, you should compile it from source. First we will install the required packages:
apt-get install libasound2-plugin-equal

Now we will create a .asoundrc file in your home directory but as your user not as root:
geany .asoundrc
That will open a blank text file, put this in:

ctl.equal {
          type equal;

        pcm.plugequal {
          type equal;
          # Modify the line below if you don't
          # want to use sound card 0.
          slave.pcm "plug:dmix";

        # pcm.equal {
          # Or if you want the equalizer to be your
          # default soundcard uncomment the following
          # line and comment the above line.
        pcm.!default {
          type plug;
          slave.pcm plugequal;

Save and close the file. To make use of the new sound configuration we will reload Alsa as root:
alsa force-reload
Now we can make use of the new EQ with:
alsamixer -D equal

The equalizer has to be added to the configuration file of mpd:
geany ~/.mpd/mpd.conf
Make following changes:

audio_output {
    type        "alsa"
    name        "My ALSA EQ"
    auto_resample    "no"
    use_mmap        "yes"
    device        "plug:plugequal"
    format        "44100:16:2"    # optional
    mixer_device    "default"    # optional
    mixer_control    "PCM"        # optional
    mixer_index    "0"        # optional

You have to add MPD to the audio group if not already done before. As root:
usermod -aG audio mpd
This command will prove if MPD is in that group:
cat /etc/group | grep audio
Now you can use MPD with alsaequal!

Optional configurations

If you use ncmpcpp then you have the possibility for some fancy visualizations, at least on Testing/Unstable with version 0.5.6-2.

To be able to use them you have to go back to the MPD configuration file and add these lines to your audio output:

audio_output {
        type                    "fifo"
        name                    "My FIFO"
        path                    "/tmp/mpd.fifo"

You can of course use your keyboard to control MPD without a GUI or because you prefer it this way. Some clients can provide that feature natively.

You can control MPD with some basic commands of MPC and making a short cut for your keyboard. Really simple:
mpc pause
will pause MPD and
mpc play
will play music.

You can use Conky with MPD too. Check the mega-thread on the forums.

LastFM/LibreFM Support

For LastFM users there is mpdscribble. Install it with:

sudo apt-get install mpdscribble
Then we will begin to edit the /etc/mpdscribble.conf:
gksudo geany /etc/mpdscribble.conf
Only change this lines according to your username and password:

url =
username = yourusername
password = yourpassword
# The file where mpdscribble should store its journal in case
# you do not have a connection to the server.
journal = /var/cache/mpdscribble/lastfm.journal

You will see, you can even scrobble to LibreFM. To activate the daemon:
gksudo geany /etc/default/mpdscribble
and change this line to look like:

# Whether to enable system wide daemon

Restart the thing (as root) with:
sudo service mpdscribble restart
and it will work, after a reboot it will also start automatically.

Sources and References

howto/mpd.txt · Last modified: 2012/06/01 23:54 by machinebacon
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Share Alike 3.0 Unported

Powered by DokuWiki. Hosted by Linode.
Copyright © 2010 CrunchBang Linux.
Proudly powered by Debian GNU/Linux.
Debian is a registered trademark of Software in the Public Interest, Inc.