Wednesday, March 31, 2010


Setting Up mpd
First, you will need to install mpd. Every self respecting linux distribution has it in their software repositories, hence the installation of the package shouldn’t be a problem. For Ubuntu it would be “sudo apt-get install mpd”, for Arch Linux “sudo pacman -S mpd” and so on. For more information on installing mpd, you can always check out their extensive wiki: The few configuration changes that have to be made, are done in /etc/mpd.conf for system-wide use, or in ~/.mpdconf for individual users. I will only explain setting it up for each individual user as it has several advantages over a system wide install such as setting up a separate music library, own playlists and resume of songs for each user individually.

1. Copy the system wide configuration file /etc/mpd.conf to ~/.mpdconf (~ denotes the users home directory):

cp /etc/mpd.conf ~/.mpdconf

2. Before we edit the config file, we will create some files and directories we will be using later on:

mkdir -p ~/.mpd/playlists
touch ~/.mpd/mpd.db
touch ~/.mpd/mpd.error
touch ~/.mpd/log

3. Now edit ~/.mpdconf to reflect these settings:

music_directory "/home/paul/downloads"
playlist_directory "/home/paul/.mpd/playlists"
db_file "/home/paul/.mpd/mpd.db"
log_file "/home/paul/.mpd/mpd.log"
error_file "/home/paul/.mpd/mpd.error"
pid_file "/home/paul/.mpd/"
state_file "/home/paul/.mpd/mpdstate"
bind_to_address ""
port "6600"

Using mpd
Now that you have mpd installed and configured, you can start using it. There really isn’t much to say about using mpd. All you have to do is running the command mpd as user and creating the music library database file. It will look into your music_directory, create an entry for each music file and put information about it in mpd.db:

mpd --create-db

The cool thing about having a command line music player daemon is that you don’t need a X server running to play music. Are you tired of your music stopping when you log on and off your system? No problem, mpd will keep running when you log on and off. When you start mpd it will also resume the last song that was playing if you abruptly stopped the mpd daemon.

If mpd gives you any trouble like not starting up, no sound or not creating a mpd.db file, check out mpd.log and mpd.error. It will give you a headstart in figuring out what’s wrong.

Setting up ncmpc++
Now we still need something to control mpd with. Ncmpcpp is almost an exact clone of ncmpc but it contains some new features ncmpc doesn’t have. It’s been also rewritten from scratch in C++ and more importantly, it’s actively being developped. As I told before, there exist other clients both command line and graphical as web based. Hell, you can even get a client that runs on your Iphone or Ipod Touch. But I can assure you, ncmpc++ pretty much does it all: playlists, crossfading, tag editing, fetching lyrics… You name it, it’s got it.

As far as I know only Arch Linux, Gentoo and FreeBSD have ncmpcpp in their software repositories. So you might have to get your hands dirty with compiling it yourself. But hey, if you already get so far reading this, it really shouldn’t be a problem. People seriously considering a console music player, probably have the skill to compile it as well. Detailed installation instructions can be found on the ncmpcpp site.

I’m not really going into the configuration of ncmpc++. The default configuration will certainly do. Only when you intend to use the tag editor, you will have to set the proper path to the mpd music directory in ~/.ncmpcpp/config (the path you also filled in the config file of mpd). The rest is a bunch of color and format settings. You can also configure the shortcut keys in ~/.ncmpcpp/keys. More on the shortcut keys later.

Using ncmpc++
You can launch ncmpc++ in the terminal with:


When you launch it, you are welcomed by the playlist window that shows the songs of the playlist you are currently listening to

Ncmpc++ Playlist

At the top, you see what menus are available and their corresponding key to access it (by default numbers from 1 to 7 and fn keys):
6:Playlist editor
7:Tag editor

The meaning of these menus are pretty obvious. A quick way to switch from the playlist to the browse menu and back is the tab key. The global keys to use in each menu are the arrow up and down to navigate and enter to select. To go to the parent directory you can use backspace. To start a selected song, press enter, s to stop a song and P to pause. > and < href="">

Gui for using mpd: pympd, pympc, gmpc and sonata.

When having an error setting up a database:
First of all setup mpd as user not as superuser!
Edit the .mpdconf file in home/paul/ and be sure to change user from mpd to your_own_username

If you want to link to a NFTS partition or drive:
When run as root, mpd drops user privileges and runs as a user specified in the file /etc/mpd.conf or ~/.mpdconf
The default was "mpd"; in order to make it work with NTFS I had to change this to "root".

Using Multiple Directories Under Parent

Simply: Use symlink(s)

Explanation: Music Player Daemon only supports one directory for the music_directory option in mpd.conf. There is a good reason for that and it is because MPD fully supports symlinks. Symlinks are easy to use. The following example will give you an idea of how to setup multiple directories under your music_directory.

* Start off by going to your music_directory, for instance if your music_directory is "/home/mpd/root" you type

user@computer ~ # cd /home/mpd/root

at a shell prompt.

* Next, if I wanted to link to /mnt/music/albums it would go like this:

user@computer /home/mpd/root # ln -s /mnt/music/albums/ /home/mpd/root/albums

Now, do note that there is no trailing '/' on /home/mpd/root/albums. That is because you are making a file to point to /mnt/music/albums/, a shortcut in the windows world.

A common problem: Remember that a symlink only points to the directory, the symlink itself has all permissions to do anything, but the directory it points to may not, if you have issues using symlinks it is probably a permissions problem with the target directory, be sure to check this.

For Ubuntu users, if your directories and files are on other devices, like /dev/hda1, you must add mpd user to "plugdev" group.

1 comment:

Macallister Farm Strong said...

How do you configure the keys in ~/.ncmpcpp/keys? A friend once gave me his configuration and it had mpd volume augmentation using the left and right arrow keys.

Blog Archive

About Me

Exclusion of liability Regarding StillStupid: The use you make of the guides, tips and downloads that you listed on this web site or on another website to which I refer is entirely at your own risk. In no way can I be held liable for damage or consequential damages of any kind, which occurs as a result of that use.