Raspberry Pi: Hifiberry DAC+

From Embedded Lab Vienna for IoT & Security
Jump to navigation Jump to search

Summary

This documentation is a step by step guide to install a Hifiberry Shield on the Raspberry Pi.

Description

Installation

Step 1

Attaching the Hifiberry board to the Raspberry Pi.

Step 2

Before enabling the Sound drivers for the hifiberry you need to disable the Sound devices which already exist one the Raspberry Pi.

Therefore, you need to comment out the following line in the /boot/config.txt:

dtparam=audio=on

Step 3 Enabling the HiFiberry Sound drivers

To enable the Hifiberry device you need to input the line that corroesponds to your device in /boot/config.txt:

Devices Diverstring
DAC FOR RASPBERRY PI 1, DAC+ LIGHT, DAC ZERO, MINIAMP, BEOCREATE, DAC+ DSP, DAC+ RTC dtoverlay=hifiberry-dac
DAC+ STANDARD, PRO, AMP2 dtoverlay=hifiberry-dac
DAC2 HD dtoverlay=hifiberry-dacplushd
DAC+ ADC dtoverlay=hifiberry-dacplusadc
DAC+ ADC PRO dtoverlay=hifiberry-dacplusadcpro
DIGI+ dtoverlay=hifiberry-digi
DIGI+ PRO dtoverlay=hifiberry-pro
AMP+ dtoverlay=hifiberry-amp

Step 4 Test the Configuration

We can easily test the success of the installation after rebooting by using aplay. Aplay is a preinstalled package to stream music in the wav format. By using the aplay -l command all available sound devices get listed.


 aplay -l
 **** List of PLAYBACK Hardware Devices ****
 card 0: sndrpihifiberry [snd_rpi_hifiberry_dacplus], device 0: HiFiBerry DAC+ HiFi pcm512x-hifi-0 [HiFiBerry DAC+ HiFi pcm512x-hifi-0]
 Subdevices: 1/1
 Subdevice #0: subdevice #0

Usage

Streaming WAV Files

Wave files can be stream directly threw the aplay package with the following command:

 aplay <filepath> 

Streaming MP3 Files

To stream MP3 music files I would suggest to install mpg123, which allows us to play most of the commonly known music file formats.

 mpg123 <filepath>

Controlling the Volume

The Raspberry pi comes with alsamixer a beautiful ASCII GUI sound mixer to use in the console.

HifiBerryAlsamixer.png

Used Hardware

References