I2S DAC Support

MusicLounge do not support I2S audio dac by default but it’s really easy to add the support of such cards.

Example 1 with Hifiberry DAC Plus RCA and Hiffiberry DAC+ PRO on Raspberry PI 4

Example 2 with Hifi Shield 2 (RCA) on Odriod C4

1- HIFIBERRY DAC And Raspberry PI 4

Make sure the board is correctly connected to the PI 4 and to the power supply (5V 3A)

# edit config.txt

pi@musiclounge:~ $ sudo nano /boot/config.txt

# add at end

dtoverlay=hifiberry-dacplus

CTRL+X to SAVE

List of Hifiberry device tree overlay:

DAC+ Standard/Pro/Amp2

dtoverlay=hifiberry-dacplus

DAC2 HD

dtoverlay=hifiberry-dacplushd

DAC+ ADC

dtoverlay=hifiberry-dacplusadc

DAC+ ADC Pro

dtoverlay=hifiberry-dacplusadcpro

Digi+

dtoverlay=hifiberry-digi

Digi+ Pro

dtoverlay=hifiberry-digi-pro

Reboot and That’s It!

Now check if card number is 1 using aplay -l

pi@musiclounge:~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 1: sndrpihifiberry [snd_rpi_hifiberry_dacplus], device 0: HiFiBerry DAC+ Pro HiFi pcm512x-hifi-0 [HiFiBerry DAC+ Pro HiFi pcm512x-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0

The trick here is to keep dtparam=audio=on (native headphone) to shift Hifiberry DAC to card number 1 to be dirrectly compatible with MusicLounge audio server settings.

if card number is different go HERE to reconfigure MPD and other audio services

and if you use the alsa equalizer plugin do not forget to change the plughw id in .asoundrc, see the tutorial here

here is a basic setup of the mpd output audio for hifiberry dac

audio_output {
type "alsa"
name "Hifiberry"
device "hw:1,0"
mixer_type "hardware"
mixer_control "Digital"
mixer_device "hw:1"
mixer_index "0"
dop "yes"
}

2- HIFI SHIELD 2 AND ODROID C4

Make sure the board is correctly connected to the C4 and to the power supply ( more info available HERE ).

# Edit /media/boot/config.ini to edit the DTBO settings. Open that file and find the part shown below. The below settings different from the default, it adds a new section named overlay_hifishield (C2) or overlay_hifishield2 (C4) and uses that section by the overlay_profile variable.

@musiclounge:~ $ sudo nano /media/boot/config.ini

For C4 Only:

; Device Tree Overlay
overlay_resize=16384
overlay_profile=hifishield2
overlays="spi0 i2c0 i2c1 uart0"
 
[overlay_custom]
overlays="i2c0 i2c1"
 
[overlay_hktft32]
overlays="hktft32"
 
[overlay_hktft35]
overlays="hktft35"
 
[overlay_hifishield2]
overlays="hifishield2"

For C2 only:

; Device Tree Overlay
overlay_resize=16384
overlay_profile=hifishield
overlays="spi0 i2c0 i2c1 uart0"
 
[overlay_custom]
overlays="i2c0 i2c1"
 
[overlay_hktft32]
overlays="hktft32"
 
[overlay_hktft35]
overlays="hktft35"
 
[overlay_hifishield]
overlays="hifishield"

Reboot and That’s It!

Now check if card number is 1 using aplay -l

pi@musiclounge:~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ODROIDHDMI [ODROID-HDMI], device 0: SPDIF-dit-hifi dit-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: ODROIDHIFI [ODROID-HIFI], device 0: TDM-B-pcm5102a-hifi multicodec-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

if card number is different go HERE to reconfigure MPD and other audio services


List of other Raspberry PI device tree overlay (untested):

502-dac
dtoverlay= hifiberry-dacplus
502-dac-pro
dtoverlay= hifiberry-dacplus
503hta-hybrid
dtoverlay= hifiberry-dac
adafruit-max98357
dtoverlay= hifiberry-dac
adafruit-uda1334a
dtoverlay= hifiberry-dac,i2s-mmap
allo-boss-dac
dtoverlay= allo-boss-dac-pcm512x-audio
allo-digione
dtoverlay= allo-digione
allo-katana-dac
dtoverlay= allo-katana-dac-audio
applepi-dac
dtoverlay= applepi-dac
audio-injector-isolated
dtoverlay= audioinjector-isolated-soundcard
audio-injector-ultra
dtoverlay= audioinjector-ultra
audiophonics-es9028q2m-dac
dtoverlay= i-sabre-q2m
bassfly
dtoverlay= hifiberry-dac
bassfly-mic
dtoverlay= googlevoicehat-soundcard
bassowl
dtoverlay= bassowl
es90x8q2m-dac
dtoverlay= es90x8q2m-dac
fe-pi-audio
dtoverlay= fe-pi-audio
generic-dac
dtoverlay= hifiberry-dac
hifibox-dac
dtoverlay= hifiberry-dacplus
iqaudio-amp
dtoverlay= iqaudio-dacplus,unmute_amp
iqaudio-dacplus
dtoverlay= iqaudio-dacplus,unmute_amp
iqaudio-digiplus
dtoverlay= iqaudio-digi-wm8804-audio
justboom-amp
dtoverlay= justboom-dac
justboom-dac
dtoverlay= justboom-dac
justboom-digi
dtoverlay= justboom-digi
mamboberry-dac
dtoverlay= hifiberry-dac
merus-amp
dtoverlay= merus-amp
nanosound-dac
dtoverlay= hifiberry-dacplus
osa-dacberry-one-plus
dtoverlay= hifiberry-dacplus
osa-dacberry-pro
dtoverlay= iqaudio-dacplus
phat-beat
dtoverlay= hifiberry-dac
phat-dac
dtoverlay= hifiberry-dac
piano-dac
dtoverlay= allo-piano-dac-pcm512x-audio
piano-dac-plus
dtoverlay= allo-piano-dac-plus-pcm512x-audio
picade-hat
dtoverlay= hifiberry-dac
pisound
dtoverlay= pisound
raspiaudio
dtoverlay= googlevoicehat-soundcard
raspidacv3
dtoverlay= raspidac3
rpi-dac
dtoverlay= rpi-dac
soekris-dac
dtoverlay= hifiberry-dac
speaker-phat
dtoverlay= hifiberry-dac
st400-dac-amp
dtoverlay= iqaudio-dacplus
taudac
dtoverlay= taudac
terraberry-dac2
dtoverlay= i-sabre-q2m

MISC.: Preparing A Minimal Linux Distro (Odriod C4 Example)


# preparing your linux distro
# before following our tutorials and build your audiophile server

# our ready to use audiophile server distribution image disk (MusicLounge) is available here

# all info below are applicable to Odroid and others boards like raspberry PI or barebone PC
# beware official Odroid Linux Kernel version (v3.16.85) is outdated and do not contains the Native DSD patch
# you need version 4.19.64 or greater to play native DSD,
# however selecting DOP MPD audio output will works with limitation

# To build the MusicLounge Audiophile Server we recommended:
# Armbian Focal or Jammy Linux Distro on Odroid C4,
# RaspiOS lite (Debian) buster or Bulleyes for Raspberry PI 4,
# latest stable Debian Standard or Ubuntu server for amd64 (buster or bullseye)

# MPD version 0.23.12 and 0.22.8 for old distribution
# myMPD version 10.2.0 and 10.7.1 for old distribution

# before building you audiophile server the software requirements are simple:
# pi user must be set
# ssh must be set
# alsa must be installed and should recognize your usb dac (command: aplay -l )

# get the img from repository (armbian, raspberry, debian)
# burn it on SDCARD (8GB is enough) with any tool like Win32DiskImager app on Windows
# connect your usb DAC
# boot
# and start the ssh session
# default login/pass:
# on odroid: root/odroid or root/1234
# on raspberry PI: pi/raspberry
# on amd64 Debian: root password is created during the installation
# on our MusicLounge distro: pi/musiclounge

# the root password needed to be changed immediately
# and a new user (non root) must be created (see below)

New root password: ************************
Repeat password: ************************

Choose default system command shell:

1) bash
2) zsh

Shell: BASH

Creating a new user account. Press  to abort

Please provide a username (eg. your forename): pi
Create password: ************************
Repeat password: ************************

Please provide your real name: Pi

Dear Pi, your account pi has been created and is sudo enabled.
Please use this account for your daily work from now on.

# sanity check

  1. $ sudo apt update -y
  2. $ sudo apt upgrade -y

# on armbian ssh is available by default

# on RaspiOS you need to add an empty file named ssh inside the sdcard before booting the OS

# on Ubuntu server amd64 SSH is activated during installation

# on Debian Standard amd64 you need to install openssh-server pkg

# on Debian netinstall you need to install sudo and pi to sudo group

  1. ~# su - root
  2. ~# apt install sudo
  3. ~# usermod -aG sudo pi

# after the first boot add user pi to sudoers on Debian

  1. $ su - root
  2. $ nano /etc/sudoers

# find line root ALL=(ALL:ALL) ALL and add this line

pi ALL=(ALL:ALL) ALL

# save
# CTRL+X then type y and enter
# go back to user

  1. exit

# install ssh server
# not needed on debian netinstall distro as you normally install SSH server during the installation process

  1. $ sudo apt install openssh-server -y

# active service

  1. $ sudo systemctl start ssh
  2. $ sudo systemctl enable ssh

# HEADLESS PC Server (boot without monitor on)
# BEWARE: if you install a distro supposed to work with GUI like Ubuntu/Debian
# and EVEN IF YOU DID NOT INSTALL A USER INTERFACE you may not be able to boot without a monitor!
# fortunately we can fix it by changed a few lines in grub bootloader to get our headless audio server

# edit grub conf

  1. $ sudo nano /etc/default/grub

# and modify the parameters of GRUB_CMDLINE_LINUX_DEFAULT and GRUB_CMDLINE_LINUX to

GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX="text"

# and obviously uncomment this line

GRUB_TERMINAL=console

# SAVE
# CTRL+X then type y and ENTER key

# now update grub

  1. $ sudo update-grub

that’s it!


# optional: if bash auto-completion (automatically completing of file names, commands and more) is not installed by default

  1. $ sudo apt-get install bash-completion

# audio check
# plug your usb DAC and type the cmd below to list soundcard, your dac must be in the list:

  1. $ aplay -l

# alsa should be already installed (not in ubuntu server no soundcard driver by default)
# if your dac is not visible, install ALSA:

  1. $ sudo apt-get install alsa-utils alsa-tools libasound2

# list devices to see if your DAC is recognized

  1. $ aplay -l
root@odroid:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ODROIDHDMI [ODROID-HDMI], device 0: I2S dit-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: D90 [D90], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

# your usb DAC should be visible in the list

# if still it’s not visible (no soundcard error)
# list installed alsa pkgs, remove them and reinstall alsa
#
# alsa-base pkg could be omited if not present in repository

  1. $ sudo dpkg -l alsa*
  2. $ sudo apt --purge remove alsa-base alsa-firmware-loaders alsa-oss alsa-source alsa-tools alsa-tools-gui alsa-topology-conf alsa-ucm-conf alsamixergui alsa-utils
  3. $ sudo apt-get install alsa-base alsa-utils alsa-tools libasound2
  4. $ sudo reboot

# check alsa status

  1. $ sudo systemctl status alsa-utils.service

# if alsa service is masked unmask it

  1. $ sudo rm /lib/systemd/system/alsa-utils.service
  1. $ sudo systemctl daemon-reload
  1. $ sudo systemctl enable alsa-utils
  2. $ sudo systemctl start alsa-utils

# check the status again everything should be okay

  1. $ sudo systemctl status alsa-utils.service

# on a minimal linux distro with only root you need to create a new user ‘pi’ (or other name) which going to be used to build your MusicLounge audiophile server
# if you’re already login as pi user skip the creation below and go to adding groups directly


# create a user pi:

  1. $ adduser pi
root@odroid:~# adduser pi
Adding user `pi' ...
Adding new group `pi' (1000) ...
Adding new user `pi' (1000) with group `pi' ...
Creating home directory `/home/pi' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for pi
Enter the new value, or press ENTER for the default
        Full Name []: PI
        Room Number []:
        Work Phone []:
        Home Phone []:
        Other []:
Is the information correct? [Y/n] y

# add new user to all default groups

  1. $ sudo usermod -aG adm,dialout,cdrom,sudo,audio,www-data,video,plugdev,games,users,input,netdev pi

# for Raspberry PI add gpio i2c spi

  1. $  sudo usermod -aG  adm,dialout,cdrom,sudo,audio,www-data,video,plugdev,games,users,input,render,netdev,gpio,i2c,spi pi
  1. $ groups pi

# reboot, login pi (skip this step if you are already logged in as pi user)

  1. $ sudo reboot
login as: pi
pi@192.168.1.11's password:
  ___      _           _     _    ____ _  _
 / _ \  __| |_ __ ___ (_) __| |  / ___| || |
| | | |/ _` | '__/ _ \| |/ _` | | |   | || |_
| |_| | (_| | | | (_) | | (_| | | |___|__   _|
 \___/ \__,_|_|  \___/|_|\__,_|  \____|  |_|

Welcome to Armbian 21.05.2 Focal with Linux 5.10.34-meson64

System load:   45%              Up time:       0 min
Memory usage:  4% of 3.73G      IP:            192.168.1.11
CPU temp:      42°C             Usage of /:    10% of 14G
RX today:      31.0 MiB

[ 0 security updates available, 4 updates total: apt upgrade ]

To run a command as administrator (user "root"), use "sudo ".
See "man sudo_root" for details.

pi@odroidc4:~$

# your linux distro is now ready

# click the link below to follow our tutorials and build the MusicLounge Audiophile Server

BUILD THE MUSICLOUNGE AUDIOPHILE DISTRO