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.

The official installation instructions and configuration guide can be found on the wiki, but here’s a rough guide to getting a set-up similar to mine going.

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 mpd.conf are:

  • music_directory set this to the directory your files are under – it will check subdirectories as well
  • bind_to_address I 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 ifconfig command. 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_output I used the following settings to turn on MPDs internal httpd server.

    audio_output {
    type "httpd"
    name "My HTTP Stream"
    encoder "lame" # optional, vorbis or lame
    port "8333"
    quality "5.0" # do not define if bitrate is defined
    format "44100:16:1"
    }

    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_play You 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.

6 Responses to “Network Audio Players and Linux Revisited”

  1. i Says:

    try ario as a desktop client, simple and does everything what it should:
    http://ario-player.sourceforge.net/

  2. Adrian Mouat Says:

    Thanks i.

    My main problem so far has been decent support for creating playlists. Whilst GMPC works, it’s a bit clunky.

  3. Justin Says:

    You should be able to just set bind_to_address to 0.0.0.0 if you want it to listen on all interfaces.

  4. Adrian Mouat Says:

    @Justin I think I tried that. It does say something about setting it to “any” though and I don’t think I tried that. Also it could just be a misconfiguration on my system.

  5. Jóhannes G. Þorsteinsson Says:

    Just wanted to post here and say that I am running MPD on a Raspberry Pi and I love it. I do agree though that the clients could be better. I am currently using ncmpcpp on my mac and mPod on my iPod Touch as a remote. The latter is bloody terrific

  6. Adrian Mouat Says:

    @Jóhannes; Just got MPD running on the Pi and I’m pretty pleased! The android client apps aren’t too bad either.

Leave a Reply