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 can then go to the next page on testing and optimizing your setup. Skip the rest of this page onDetailed 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
However, if you see the following lines:
blacklist i2c-bcm2708
blacklist snd-soc-pcm512x
blacklist snd-soc-wm8804
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
Create asound.conf file
Edit the raspi modules list with
sudo nano /etc/asound.conf
This file ought to be blank!
- 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”
- }
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
Then add:
dtoverlay=hifiberry-dac
dtoverlay=i2s-mmap
on the next line. Save the file.
from:https://learn.adafruit.com/adafruit-max98357-i2s-class-d-mono-amp/raspberry-pi-usage