Getting the Wolfson Audio Card working with Volumio

I purchased a Raspberry Pi some years ago to use as a media player in my home. For a while, it was setup Raspbmc. This worked very well for sometime and was even able to stream Amazon Prime video. Unfortunately my video library is quite small here and Amazon turned on DRM on their video streams, making the media center not particularly useful. My 15 year old CRT television didn’t help either.

After this, it was relegated to duty as a home server with some USB hard drives running Raspbian. This worked well, except every web service I tried to run on the device ran really poorly — Owncloud, Cozy among others. I believe the problem is a combination of having a small amount of RAM and the fact that the network and the hard disks sit on the same USB bus. I ended up picking up a Cubox-i4 (the price recently went way up!) to replace the RPi for home server use. I’ll put together another post regarding this sometime soon.

I ended up purchasing the Wolfson DAC from Element14. This card has some really nice specs — 24bit/192kHz playback, headset and line-out as well as two microphones and a line-in. Finally, it can also receive and transmit SPDIF. I didn’t realize this when I way buying it, but the support for the board isn’t included in the mainline Raspbian distribution. E14 releases an image, but that’s inconvenient when there’s another image you wanted to install. For some time, it appeared that the card support would be put into the mainline distribution, but efforts on that seem to have stalled after Cirrus Logic purchased Wolfson. Hopefully they’ll continue working on it.

After spending some time cobbling together my own MPD based audio-only media center, I discovered the Volumio project. They’ve done a nice job of configuring MPD and providing a nice web interface in which to make changes. They also support a variety of I2S DACs since the default audio output on the Raspberry Pi is prone to lots of clicks and pops. Unfortunately the Wolfson DAC isn’t on their supported list. This is how I got the latest Volumio (1.5) working with the Wolfson DAC.

  1. Download the latest Volumio release.
  2. Unzip and flash the image to your SD card.
  3. Download the patched kernel from Rangar Jensen. The patched kernel source is also available if you would like to compile your own.
  4. Mount the SD card on your local PC and copy the boot/kernel_wolfson.img to the small boot partition.
  5. Copy the lib/ directory into the root of the large main partition. This contains the files needed to support the new kernel.
  6. Copy the use_case_scripts directory into /home/volumio in the large partition.
  7. Edit the config.txt file on the small partition to add the line kernel=kernel_wolfson.img.
  8. After hooking the Pi up to your network and amplifier, power it on.
  9. Use SSH to log into the device. It’s probably a good idea to change the default credentials and to recreate the SSH private keys. Run the use_case_scripts/ as root. This will setup the output to go to the lineout (green) output on the Wolfson board.
  10. Use the web interface to add your music sources. I am using NFS to share my music files from my Cubox.
  11. In order to use the to use the Volume control in the Web UI and MPD clients, you need to make a manual change to /etc/mpd.conf. You will not be able to use the Volumio web interface to configure the Playback settings unfortunately. The web interface wil overwrite this change when you save it. Using your editor of choice, edit the output section of the /etc/mpd.conf file to read the following:

    audio_output {
                 type           "alsa"
                 name           "Output"
                 device         "hw:0,0"
                 mixer_control  "HPOUT2 Digital"
                 mixer_device   "hw:0"
                 mixer_index    "0"
                 dop    "no"}
  12. Reboot the RPi and enjoy!

I also found that I had to make an additional change in order to get the Spotify integration working. In the /etc/spopd.conf, I had to change audio_output = sox to audio_output = ao. After this, it works great!