Last Updated on August 11, 2021
Linux offers a mouthwatering array of open source music players. And many of them are high quality. I’ve reviewed the vast majority for LinuxLinks, but I’m endeavoring to explore every free music player in case there’s an undiscovered gem.
MPD is a powerful server-side application for playing music. In a home environment, you can connect an MPD server to a Hi-Fi system, and control the server using a notebook or smartphone. You can, of course, play audio files on remote clients. MPD can be started system-wide or on a per-user basis.
I’ve covered a fair few MPD clients over the past year or so including Cantata, Ymuse, ncmpy, and ncmpc. My favorite of them is Cantata although Ymuse is a simple alternative. There’s lots of differences between these front-ends. For example, Cantata uses the Qt widget set, whereas Ymuse offers a GTK front-end. And ncmpy and ncmpc are terminal-based clients.
ympd takes a different route. It’s a web-based client. This software lets you use your web browser to interact with MPD. ympd runs without a dedicated web server or interpreters like PHP, NodeJS or Ruby. It’s tuned for minimal resource usage and has minimal dependencies. The software uses Websockets and Bootstrap/JavaScript.
Installation
With any MPD client, the first stage is to install and configure MPD. I set up MPD and ympd both in Arch and Ubuntu. For brevity, I’ll discuss installation of ympd on Ubuntu only.
In Ubuntu, we install MPD with the command:
$ sudo apt install mpd
Next we need to configure MPD. We’re not going to detail the steps to take in this aspect as there’s lots of guides that show you how to configure MPD. But the configuration requires editing a text file, ~/.mpdconf.
In that file, we define files and directories. We run MPD owned by the user, rather than mpd. Here’s some of the lines in that file. They won’t necessarily reflect how you will want to set up MPD. For example, our music directory resides at ~/Music, whereas it’s likely your music collection will be in a different location. [In fact, ~/Music is just a symbolic link].
music_directory "~/Music" playlist_directory "~/.mpd/playlists" db_file "~/.mpd/tag_cache" log_file "~/.mpd/mpd.log" pid_file "~/.mpd/pid" state_file "~/.mpd/state" sticker_file "~/.mpd/sticker.sql" audio_output { type "pulse" name "MPD" }
MPD only allows a single directory to define the music directory. But that’s not an issue. If you use multiple music directories, just use symbolic links.
On our Ubuntu installations, we need to install a dependency.
$ sudo apt install libmpdclient-dev
Now we clone the project’s repository and compile ympd.
$ git clone https://github.com/notandy/ympd.git
$ cd ympd
$ mkdir build
$ cd build
$ cmake .. -DCMAKE_INSTALL_PREFIX:PATH=/usr
$ make -j4
And to install the software:
$ sudo make install
There’s a package for Raspbian, and some distros offer packages.
Next page: Page 2 – In Operation
Pages in this article:
Page 1 – Introduction / Installation
Page 2 – In Operation
Page 3 – Summary
I needed to install git, cmake, libssl-dev as well (RaspiOS Lite install)