Archive | January 2013

Improved sound quality using an external USB soundcard on Raspberry Pi

So after setting up MPD on my Raspberry Pi, I managed to get transmission daemon and NFS running. You can use about any good tutorial for this, since there are no special tricks involved – everything works just like on a normal GNU/Linux box.

However, you can’t expect a 35€ device to ship with a great DAC. I’m not really what you would call an audiophile, discussing how the new USB cable totally changed the sound characteristics, and how everything now sounds fresher, warmer, crisper whatsoever. Nevertheless, since I just didn’t like the Pi’s analog output, I ended up buying an external soundcard, an ESI Dr. Dac, which got good reviews on the net. It is a dead-simple device which features a single 3,5mm jack which is used for both the analog and optical digital out. The best part however is that it just works out of the box without any hassle. And of course, the sound is notably better than before (fresher, warmer, crisper).

All I had to do is to connect it to the Pi and remove line containing ‘snd_bcm2835‘ from /etc/modules, since I won’t need the analog output anymore. This way, the Dr. Dac automatically gets the default pulseaudio device, and MPD will use it for sound output. Yeah, that’s all, we’re done.

Unfortunately it does not seem to be that easy to convince XBMC to use the Dr. Dac for sound output. There is some kind of support for this, but it is far away from stable and made my XBMC crash. Maybe I’ll dig into this someday, but until then I’m happy with this setup. Most of the time I’m using the Raspberry Pi to listen to music, and once every two weeks or so I have to connect my amplifier directly with the Pi instead of the Dr. Dac. No, I don’t mind the sound quality when watching series.

Setting up MPD on a Raspberry PI with a RaspBMC installation


UPDATE:

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.