MPD – Music Player Daemon

MPD is not for everyone.

Before continuing into the article, a word of warning. MPD is not for everyone. If you are a casual desktop linux user with zero geek genes, stay away from this player. There are many other simpler players for you.

But then again, ‘casual desktop linux user’ – that sounds like a contradiction in terms. The very fact that you are reading this means that you are a geek.

Getting Started with MPD

Setting up MPD is not as simple as other music players.

Installation

To see MPD in action, first we have to install MPD – and a client. I installed the following…

  • MPD server
  • MPC – A command line MPD client
  • gmpc – A GUI client for Gnome

In a RedHat based system, you can install these using the command…

yum install mpd mpc gmpc

Configuration

Here is where it starts to get a bit confusing. MPD don’t have a pretty GUI to go along with it. It has to be configured using a text file. Create a file ‘.mpdconf’ in your home folder and enter the following in it…


port					"6600"
music_directory         "~/Songs"
playlist_directory      "~/.mpd/playlists"
db_file                 "~/.mpd/mpd.db"
log_file                "~/.mpd/mpd.log"
error_file              "~/.mpd/mpd.error"

The ‘music_directory'(“~/Songs” in our example) must point to the folder where you keep your music. If you have your music in multiple folders then I cannot help you. MPD was designed with just one music root directory in mind.

It is a good idea to create the playlist folder now – it will prevent errors later on. To do that run the command…

mkdir -p ~/.mpd/playlists

Next run these commands…

mpd --create-db
mpc update
mpc add /
mpc play

If all went well, you must be hearing sweet music now. Here is an explanation of the commands we used and their purpose…

mpd –create-db
This will start the daemon. The ‘–create-db’ argument will read the contents of the root music directory and add the Music files to a text database. You should see the list of files being added into the DB. This may take some time to complete – based on size of your music collection.
mpc update
The command used here is ‘mpc’ – not ‘mpd’. We are using a command line client now. This command scans the root music directory for updates.
mpc add /
This command will add all the files in the music directory to the current playlist. Please note that the ‘/’ here means root music directory – and not the global linux root.
mpc play
This will start playing the files in the current playlist.

GUI Clients

There are many GUI clients for MPD – the ones I would recommend are…

  • Gnome Music Player Client(gmpc)
  • Sonata

Once the mpd daemon is up and running, just open these clients and click on the connect button to control the daemon using these clients.

4 comments

  1. It is possible to use multiple music directories. In Linux just add symbolic links in MPD’s main music directory.

    I can also recommend Ario as a client. It is very comfortable and supports lyrics and covers. Available for both Linux and Windows.

  2. Thanks for the article! I was stuck trying to work mpd and mpc for about an hour. Turns out all I needed was to use the “mpc update” command you wrote.

  3. Ha, Christian thought about symlinks first… Alright I only came to this blog today.
    The article might be better if it sarted with an outline of features/benefits.

  4. I wonder if there is some way to have different playlists, at the same time we update each one independently, in some easy way. I can’t think of how it would be possible, if there’s only one music directory to update from. I can’t understand why it won’t simply read a playlist and read the files mentioned on it like a normal player. If it will be restricted to a given folder anyway, then what’s the point of having a playlist? It seems to me more redundancy than something useful. It may have some utility, but dealing more normally with playlists would make of it a less exasperating program. :/

Leave a Reply

Your email address will not be published. Required fields are marked *