Setting up MPD on a Raspberry PI with a RaspBMC installation


Yesterday I installed RaspBMC Final. PulseAudio is now running out of the box, so you can skip the installation and setup of ALSA.

Well, there are probably millions of tutorial for this, but still I decided to write down all the necessary steps to set up MPD on my “media center” at home. All this is done on a fresh install of RaspBMC RC5 / XBMC RC2, as released on the 30th of December. The steps are fairly straight-forward.

Let’s start with enabling sound output through ALSA and PulseAudio:

sudo modprobe snd_bcm2835

Furthermore we’ll add “snd_bcm2835” (without the parentheses) to /etc/modules, so it will be loaded on startup.

Then, install MPD:

sudo apt-get install mpd

Now let’s configure MPD. To do this we must edit /etc/mpd.conf. The file contains a lot of comments which explain the configuration settings in detail. I’ll go through all the things I needed to change in order to get MPD working. First, MPD needs to find the music. I keep my music on an external disk which I connect directly to the Raspberry PI. RaspBMC mounts it automagically on /media/. Hence, “music_directory” points to “/media/media-disk/Musik”.

I also want the playlists to be on this disk. Thus, “playlist_directory” is set to “/media/media-disk/Musik/playlists”.

While read-only access to the disk suffices for reading the music, if I want to save MPD playlists, I’ll need write access. RaspBMC mounts the disk with the user “pi”, with write permissions for the user’s group, but not for others. Since MPD will run with its own user called “mpd”, I changed MPDs group to “pi”. Furthermore, I want to control the daemon from other devices, so I changed “bind_to_adress” to “any”.

Last but not least you have to configure an audio output. I use PulseAudio for the moment, since it worked out of the box, but I’ll consider moving directly to ALSA if I notice performance issues. It’s as simple as it can be:

audio {
  type   "pulse"
  name   "Wohnzimmer"

And that’s it. The complete configuration file can be found here.

Next, I’ll configure NFS to access my media files from any device at home, and make transmission-daemon work.



Tags: , , , , , , , , ,

4 responses to “Setting up MPD on a Raspberry PI with a RaspBMC installation”

  1. Henning says :

    The required module is called ‘snd_bcm2835’, not ‘snd_bcm2385’…

  2. Karel says :

    Very helpful! Thanks!!

  3. Halgeir says :

    Thank you! I play the sound through the HDMI interface. The sound quality was bad with pulse audio (stuttering sound). Had to use the alsa. But then the problem was that the mpd crashed every time I started to do something on the Xbmc.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: