Add a sound card in your Raspberry Pi



If you find the integrated sound card to your Raspberry Pi3 is a bullshit, this tutorial is for you.

I buy a DollaTek PIFI Digi DAC+ based with the TI's DAC chip PCM5122, using an I2S interface.



Feature:

  • Sampling Frequency:384KHz 
  • Resolution (Bits) :16-32 
  • Digital Audio Interface :I2S 
  • SNR :120dB 
  • THD:-93dB 
  • Dynamic range :112dB 
  • Supports Raspberry Pi B+, Raspberry Pi 2 Model B,Raspberry Pi 3B (64-bit)

How to do

Update your OS

sudo apt-get update
sudo apt-get upgrade

update the driver modules

sudo vim /etc/modules
Remove :
  • nd_bcm2835 
  • i2c-dev 
Add :
  • bcm2708_dmaengine 
  • snd_soc_pcm512x 
  • snd_soc_hifiberry_dacplus 
  • snd_soc_bcm2708_i2s

Configure device tree overlay file

sudo vim /boot/config.txt
dtparam=i2c_arm=on
dtparam=i2s=on
dtoverlay=hifiberry-dacplus
dtparam=audio=off

Configure ALSA Mixer

sudo vim /etc/asound.conf
pcm.!default {
type hw card sndrpihifiberry
}
ctl.!default {
type hw card sndrpihifiberry
}

Shairport-sync

If you use Shairport-sync (Airplay), modify the configuration file.
sudo vim /etc/shairport-sync.conf
alsa =
{
output_device = "hw:sndrpihifiberry"; // the name of the alsa output device.
mixer_control_name = "Digital"; // the name of the mixer to use to adjust output volume.
}
sudo systemctl restart shairport-sync

Raspotify

If you use Raspotify (Spotify connector), modify the configuration file.
sudo vim /etc/raspotify/conf
LIBRESPOT_DEVICE_TYPE="speaker"
LIBRESPOT_BACKEND="alsa"
LIBRESPOT_MIXER="alsa"
# HifiBerry Soundcard
LIBRESPOT_ALSA_MIXER_CONTROL="Digital"
LIBRESPOT_ALSA_MIXER_DEVICE="hw:sndrpihifiberry"
sudo systemctl restart raspotify

Comments