If you hang around certain circles on the Internet(tm), you'll eventually run across some people who are obsessed with efficiency and minimalism1. I can get behind that sentiment (though I'm not a fanatic about it2).
When the topic of media players comes up, the discussion seems to almost always point to mpd, mpc, and ncmpcpp. I've been using the Clementine Music Player, which is a good player. It hasn't seen any updates in several years, but It Still Works™, so that's nice, but I wanted to take a look to see how the other side lives, so to speak.
What is mpd anyway?
mpd
is the Music Player Daemon3. It's a program that sits around and waits for another program to tell it to do something. Sometimes mpc
, sometimes something else, but mpd
doesn't have an interface of its own, so you can't control it directly.
Problems
Right away, I had trouble installing mpd. It turns out that there's another program called mpd
in the FreeBSD repositories: net/mpd5, which is used for multi-link PPP connections4. The companion program that's often bundled with mpd
in Linux distributions is mpc
, but there's another program called mpc
, math/mpc, which is a 'Library of complex numbers with arbitrarily high precision', i.e. probably not what we want.
Installation
Now that we're thoroughly confused, it's time to install software! We'll want to install audio/musicpd
, audio/musicpc
and audio/ncmpcpp
5. Since I use ports, I can install it with something like:
portmaster -D audio/musicpd audio/musicpc audio/ncmpcpp
Or I could install this from packages if I didn't feel like building these.
Setup
Setup is not as easy as I had hoped. Installing musicpd
does a few things. It sets up a service that you can run if you want (spoiler: I do), it provides a configuration file with some questionable defaults, it creates a user named mpd
with its home directory in /var/mpd
that the service will run as (the service is called musicpd
.
Whew!
Before starting to work on the config file (/usr/local/etc/musicpd.conf
, I backed it up so I could get back to zero if I screwed something up.
My system has the current considerations:
- I have my music files stored in
/outerspace
- I commented out the line to use Unix sockets. The default is to listen on TCP port 66006. I couldn't get the player programs I tried to connect otherwise, probably due to user error
My changed lines look something like this:
/usr/local/etc/musicpd.confmusic_directory "/outerspace/music"
#bind_to_address "/var/mpd/.mpd/socket"
There are lots of other options that are pre-filled in with reasonable values, so I left them. Taking note of them, I noticed that they all have paths like /var/mpd/.mpd/somedirectory
, and the problem is that .../.mpd
and somedirectory
(and, in some cases, somefile
) don't exist, so I had to create these manually and assign ownership to the mpd
user. Since I was very lazy and didn't bother writing down which folders and files it wanted, I tried to start up the musicpd
daemon with service musicpd onestart
and looked at the output to see what it was complaining about missing, then either mkdir
the missing directory or touch
the missing file and trying again. It turns out that this step wasn't needed for the database
file. Even though musicpd
complained that the database didn't exist, it created it anyway.
I kept onestart
ing the service until the service actually started. I ended up creating the following directories:
/var/mpd/.mpd
/var/mpd/.mpd/playlists
And I ended up touch
ing /var/mpd/.mpd/database
even though I didn't really need to.
Once the service onestart
ed without any griping I added musicpd_enable="YES"
to my rc.conf
Once it's started, nothing apparently happens. That's where musicpc comes in. Only the binary and the man page is named mpc
, even though the port and package is musicpc
. You can use musicpc
to control musicpd
and to do a whole lot more stuff than I'm going to list here. Right now I'm interested in seeing if musicpd
can even see my music library. Running mpc ls
will produce output if it does, and no output if it doesn't. If it doesn't, might need to check permissions on wherever the music files are stored, or *gasp* check the logs for errors. Once I was satisfied that it saw my library, I followed the man page's advice and ran mpc ls | mpc add
to just add everything to the default playlist.
Actually playing music
Now, finally, I ran ncmpcpp and saw the ncmpcpp screen and a giant list of the music in my collection. I can search by using the forward-slash operator, I can play a track by hitting 'enter', I can stop playback with 's'. Since this isn't an ncmpcpp tutorial (mostly because I haven't learned that much about it yet), I can't tell you much more than that.
Thoughts
This was a bear to set up. Partially because the docs I found assume that you're running Linux (I'm not). It's nice that I can actually close ncmpcpp and the music will keep playing, and that the player seems to be more focused than Clementine-player is. I haven't decided yet if the amount of work I had to put in is outweighed by the benefit I'll get out of it.