Setting up an MPD server on Ubuntu 10.04

Ever wonder how the super geeks power their home speaker system? As in, the speaker system running through out their house? Probably with MPD. MPD is a very powerful piece of software that allows you to play, stream and control your entire music collection over TCP/IP.

What is MPD?

MPD Stands for Music Player Daemon. This is a Daemon for Linux, Windows or Mac which allows you to play music. Sounds pretty basic right? Wrong! It has full database support, supports anything FFMPEG can play, (mp3, ogg, wma, flac, etc) runs quietly in the background, and supports administration over IP from multiple clients at the same time! It’s quite simple to get setup  and with the same ease and features of say iTunes or Windows Media Player (play lists, shuffle, full search functions) it’s a wonder I never used it before!

The Setup

Requirements
~Server
~Working sound card (if you want to play the music off the server)
~Ubuntu Install (This will work on other distros, its just that this guide is written for Ubuntu)

My Setup
~2.6Ghz P4 with 768MB Ram and 60GB of storage (total overkill for this job, plus I only paid $20!)
~Hitachi 100W Book Shelf Speaker System (Price was right and they sound pretty good!)

Prep Work

After you get Ubuntu installed, put all the music on the server and take note of the directory that you used.  Make sure that the permissions are set so that anyone can read the files.  Next, if you plan on using the sound card on the server to play music, make sure it works before you get this all setup. My sound card has some compatibility issues with Linux which are resolved by plugging in the speakers in to the mic port and enabling surround sound :) . Even if you can’t get sound to work on the server, MPD can stream via ogg.

Installing and Configuring

apt-get install mpd

It is going to download 10MB of archives, so you just got to give it a sec to let it complete…(Just be thankful you are not on my university internet…. Yea, a full 4KB/s!)

After that finishes, it will start the daemon with it’s default settings, so we need to edit the config file.

nano /etc/mpd.conf

First off, change the “music_directory” to your actual music directory.

Next, go to “bind_to_address” and enter in “127.0.0.1″. For some reason or another, MPD does not like localhost even though it is the default. Probably an Ubuntu thing…

Continue scrolling down until you get to audio_output. If you plan on using default alsa then it’s all good, it should already be configured. Now, if you want to stream your music over a network and not use alsa, comment out the alsa part by putting # in front of each line of configuration for it, there are a few! Next, pick the protocol that you wish to use and un-comment it. For example, I wanted to use the HTTP streaming server, so mine looks like this:

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

Under encoder, select vorbis to use ogg vorbis format, or lame for MP3. Unfortunately, due to patent issues, you are going to have to download and compile MPD  directly from their site for it to work.  The last step is to restart the daemon.

sudo service mpd restart

And that’s it! If you don’t get any error messages, then it should be working!

Controlling the System!

Now to controlling it is the next step. There are several different methods depending on what operating system you are using. Each one is fairly easy to configure. All you need to do is punch in the IP address for your server and that’s it!

Here are my top picks:

Linux and Windows

Gnome Music Player Client ~ Works great and has all the features to make the most of MPD.

GMPC User Interface

Mac

Theremin ~ This is what my roommate uses on his Macbook, really slick interface.

Firefox

Music Player Minion ~ A neat Firefox plug-in that sits nice and neat on the bottom of your page.

If you are not happy with the above clients, this site has a good list of all the different clients you can use!

Have you setup MPD or have a great idea or know of another awesome client? Leave me a comment!

You can leave a response, or trackback from your own site.

Leave a Reply


− two = 4