Raspberry Pi Setup

At this time, Jessie Raspbery Pi kernel does not support mono audio out of the I2S interface, you can only play stereo, so any mono audio files may need conversion to stereo!

Fast Install

Luckily its quite easy to install support for I2S DACs on Raspbian Jessie.

These instructions are totally cribbed from the PhatDAC instructions at the lovely folks at Pimoroni!

Run the following from your Raspberry Pi with Internet connectivity:

curl -sS https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/i2samp.sh | bash

You will need to reboot once installed.

You must reboot to enable the speaker hardware!

After rebooting, log back in and re-run the script again...It will ask you if you want to test the speaker. Say yes and listen for audio to come out of your speakers...

In order to have volume control appear in Raspbian desktop or Retropie you must reboot a second time after doing the speaker test, with sudo reboot

You can then go to the next page on testing and optimizing your setup. Skip the rest of this page on Detailed Installation if the script worked for you!

Detailed Install

If, for some reason, you can't just run the script and you want to go through the install by hand - here's all the steps!

Update /etc/modprobe.d (if it exists)

Log into your Pi and get into a serial console (either via a console cable, the TV console, RXVT, or what have you)

Edit the raspi blacklist with

sudo nano /etc/modprobe.d/raspi-blacklist.conf

If the file is empty, just skip this step

However, if you see the following lines:

blacklist i2c-bcm2708
blacklist snd-soc-pcm512x
blacklist snd-soc-wm8804

Update the lines by putting a # before each line

Save by typing Control-X Y <return>

Disable headphone audio (if it's set)

Edit the raspi modules list with

sudo nano /etc/modules

If the file is empty, just skip this step

However, if you see the following line:

snd_bcm2835

Put a # in front of it

and save with Control-X Y <return>

Create asound.conf file

Edit the raspi modules list with

sudo nano /etc/asound.conf

This file ought to be blank!

Copy and paste the following text into the file

pcm.speakerbonnet {
   type hw card 0
}

pcm.dmixer {
   type dmix
   ipc_key 1024
   ipc_perm 0666
   slave {
     pcm "speakerbonnet"
     period_time 0
     period_size 1024
     buffer_size 8192
     rate 44100
     channels 2
   }
}

ctl.dmixer {
    type hw card 0
}

pcm.softvol {
    type softvol
    slave.pcm "dmixer"
    control.name "PCM"
    control.card 0
}

ctl.softvol {
    type hw card 0
}

pcm.!default {
    type             plug
    slave.pcm       "softvol"
}

Save the file as usual

Add Device Tree Overlay

 Edit your Pi configuration file with

sudo nano /boot/config.txt

And scroll down to the bottom. If you see a line that says: dtparam=audio=on 

Disable it by putting a # in front.

Then add:
dtoverlay=hifiberry-dac
dtoverlay=i2s-mmap

on the next line. Save the file.

Reboot your Pi with sudo reboot

Last updated on 2017-08-10 at 11.16.51 AM Published on 2017-11-21 at 11.46.30 PM