Network Audio Players and Linux Revisited
In my previous post Network Audio Players and Linux, I described some ways in which to stream music from a Linux server to network audio player (primarily the Denon DNP-720AE). In the comments to that post, mjheagle suggested I try out MPD, which I’d missed when trying out various solutions. This post describes the benefits of the MPD solution (which is by far the best one I’ve tried so far) and how to get it going for yourself.
The highlights of this solution are:
- The remote client support means I can control the playlist from any computer, including my Android phone which makes for truly great remote control.
- The network player displays the mp3 metadata correctly, including artist, album and track title. This isn’t always the case with other solutions.
- I can get it all going in a few clicks.
- It seems to be pretty light on resources.
The downsides are:
- The MPD client software could be better. GMPC for example is very feature rich, but could do with some usability work.
- Getting MPD up and running wasn’t as simple as I would have liked. It took some experimentation to get things running correctly.
Start by installing MPD. If you’re on Ubuntu, you should be able to just use
sudo apt-get install mpd or the Software Centre. Next, you need to configure MPD for your set-up by editing
/etc/mpd.conf. You might find this Ubuntu page more helpful than the official wiki. Note that you don’t need to worry about pulseaudio if you just intend to use MPD as a remote server. The important options to set in
music_directoryset this to the directory your files are under – it will check subdirectories as well
bind_to_addressI had to set this to the local IP address of the computer (e.g.
192.168.1.1) rather than just use localhost. You can check your address with the
ifconfigcommand. This might be a bit of an issue if you are using DHCP (as your address may change on reboot) but you should be able to configure your router to always provide the same address.
audio_outputI used the following settings to turn on MPDs internal httpd server.
name "My HTTP Stream"
encoder "lame" # optional, vorbis or lame
quality "5.0" # do not define if bitrate is defined
Note that “lame” is an MP3 encoder and probably what you want to use for compatibility with most devices. The internal server seems to work well and be light on resource usage. I’d recommend using it rather than trying to configure IceCast.
buffer_before_playYou probably want to reduce this setting as otherwise there is quite a few seconds of lag before changes take effect.
You should now be able to start MPD with a command such as:
sudo service mpd start
However, to control MPD you will need to use some sort of client. There is a very simple (but effective) command line client called mpc and also plenty of gui ones such as GMPC and Sonata (I haven’t taken time to play with them all yet). More interestingly, you can also set up a web based client (so you can control MPD from a webpage) or use an Android or iOS client. At the minute I’m using GMPC and the Droid MPD Client. A full list of clients is available on the wiki. When setting up your client, note that you need to connect to the MPD server interface (default port 6600), not the httpd interface (which is the output stream). This may sound deafeningly obvious, but I still managed to waste an hour by getting my ports confused. When you first connect to via the client, the database will probably be empty – you will need to run the update command and wait for MPD to process your files.
At this point, you still need to connect your Network Audio Player to the stream. I assume many players can simply be pointed at the IP address, but the only solution I found with my Denon DNP-720AE was to log onto Radio Denon and set up a station pointing to the MPD server. In my case, the URL looks like http://192.168.1.3:8333/mpd.mp3 (note the mpd.mp3 at the end, you may or may not need this).
So far everything is working pretty well, although I would like a better desktop client. My next step will be to install MPD on a Raspberry PI or similar, so I don’t need to have my main computer on to listen to music.
UPDATE: I’ve now got MPD running on the Raspberry PI and it’s a pretty nice set-up. One issue is that my network player will disconnect whenever the stream stops, so you have to make sure MPD is constantly playing something.