A few words about MPD
MPD is the superior way to access your music library
I remember many years ago, when I was a Windows user, and even later after I made the switch to Linux, I always struggled to find the perfect music player that would fit my needs perfectly. From time to time I would fantasize about programming my own little, perfect, shiny music player program that would fit my needs perfectly like Cinderella’s shoe. But I was nowhere near naïve enough to actually start the project, let alone finish it. I know how much time and effort it would take. Then I discovered mpd
(Music Player Daemon).
The idea of mpd
is elegant and simple. A server that runs as a daemon and serves music to different clients. It is always on in the background, ready to be requested anything from its library. It is powerful and extensible through plugins, and supports multiple audio interfaces. Several client applications can be used to talk to it. My client of choice is ncmpcpp
, a C++ version of ncmpc
with some improvements, but there are countless others for all needs and tastes. The awesome thing is that the library is handled by mpd
, so that switching clients doesn’t mean reimporting everything. In this post I document how to set up mpd
in Arch Linux as a user service, and how to configure it. It is so simple that this introduction is longer than the actual setup. Bear with me.
First, we need to install mpd
:
yay -S mpd
Once that’s done, we need a configuration file. The default location is ~/.config/mpd/mpd.conf
. My configuration file contains the paths to the music directory, as well as the database, log files, and others. Then, a few lines to define the audio interfaces and the visualizer (if you need that).
|
|
Then, enable and start the service in user mode:
systemctl --user enable mpd.service
systemctl --user start mpd.service
mpd
should now be ready to serve music. To test it, open ncmpcpp
and press u
to initialize/update your music library. A few seconds later –or minutes, depending on the size of your library– all your music will be perfectly organised and available in the player, ready to be listened to, a few keyboard strokes away. Pair it with a polybar
module and a few i3wm
bindings, and it’s over 9000.
bindsym $mod+period exec mpc next
bindsym $mod+comma exec mpc prev
The two lines above bind $mod
+.
and $mod
+,
to play the next and previous song respectively. So easy.
My ~/.config/ncmpcpp/config
file is pretty basic. I mostly go with the defaults, but here it is in case you need it:
|
|
And that’s it. Nowadays it is quite straightforward to configure a fully-featured audio server in your Linux box and pair it with a no-nonsense, CLI player that is lightweight and feels amazing to use.