the website of dither8

Best Linux music player: mpd

Published on 2020-06-10

Update 2021-09-15: fixes and clarity

ncmpcpp Screenshot

I always struggled to find a good music player a couple of years ago. In order for a music player to be worthy it must succeed in 3 major areas: playback, management and presentation. The vast majority of players I came across failed in the later two categories. It would either suck at watching and updating the library for changes, or would fail to present the library in a good order (e.g. albums with multiple artists would be sorted via artists which would mean the track order was out-of-order).

In recent years I have found and used mpd the music player daemon. It's approach is quite different, it is only responsible for the playback and management, leaving the presentation to external front-end applications. As the daemon portion of the name might suggest, it is a server process that runs in the background. The client applications effectively act as a remote control to mpd, which also presents a way to view your queue and library.

Thanks to the way this works, you can use multiple front-ends simultaneously. Since each player simply sends a command to mpd to skip, play, pause etc. and your music library is ever-present across all front-ends.

mpd can be found in most software repositories, it is possible to run mpd either as a system or user process. On my system I choose to start it as my user. Which means we need to install some configuration under our .config folder, simply create a folder in .config called mpd and in that folder create a text file called mpd.conf. Here is an config to get you started:

db_file            "~/.config/mpd/database"
log_file           "~/.config/mpd/log"
music_directory    "~/Music"
playlist_directory "~/Playlists"
pid_file           "~/.config/mpd/pid"
state_file         "~/.config/mpd/state"
sticker_file       "~/.config/mpd/sticker.sql"

auto_update "yes"
bind_to_address "127.0.0.1"
restore_paused "yes"
max_output_buffer_size "16384"

audio_output {
	type        "pulse"
	name        "pulse audio"
	mixer_type  "software"
}

audio_output {
	type    "fifo"
	name    "toggle_visualizer"
	path    "/tmp/mpd.fifo"
	format  "44100:16:2"
}

Feel free to edit the directory/locations to your liking. mpd will generate it's own files, but for some it will throw up an error if the file/folder doesn't exist. Simply use the touch command to correct this.

Using your init system, probably systemd, enable the process to start automatically and then start it:

systemctl enable mpd.service --user
systemctl start mpd.service --user

mpd Front-ends

Now lets take a look at a front end for mpd that will actually control this thing! I have ended up using ncmpcpp a terminal application with a hard-to-pronounce name. It comes with queue control, lets you browse through your music either as a filesystem or a library, search, playlists and a tag editor. For new users it can be difficult to navigate, but you can press F1 at anytime to view keybindings.

mpd has plenty of choice when it comes to frontends. I suggest also checking out Cantata which is a comfy GUI client. Of course there is a client for any occasion at the mpd website.

Before I forget here are some basic ncmpcpp configurations that you will want to create at .config/ncmpcpp/config:

ncmpcpp_directory = ~/.config/ncmpcpp
lyrics_directory = ~/.local/share/lyrics
mpd_host = 127.0.0.1
visualizer_type = spectrum

That should be enough to get you started if you decide to go with ncmpcpp.

Conclusion

I am very happy with mpd for my music player. I suspect that I will be using it for a very long time.