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.
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
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.
There are many GUI clients for MPD – the ones I would recommend are…
- Gnome Music Player Client(gmpc)
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.