MediaLounge Audiophile Home Theater Server


# Audiophile Music Player And Kodi Home Theater Software#
# the best combo to take benefit to your audio and video system
# Ubuntu Kinetic Kudu Live 22.10 Based (Kernel 5.19)

# follow instructions below to build your own Audiophile Home Theater Server
# MediaLounge server includes almost all audiophile services of MusicLounge with the addition of Kodi Home Theater software, HEVC – 4K60fps – HDR10 supported (tested on Intel NUC)

# To get the best audio quality
# Connect the USB dac to the stereo HIFI pre-amp using a dedicated stereo hifi speakers
# and the HDMI cable to a 3.1 or 5.1 or 7.1 AV Receiver with dedicated home theater speakers


# Full Session Transcription

# install Ubuntu Live Server amd64

# select minimal server installation (set Minimized option)
# username pi
# hostname medialounge

# pick username pi
# password musiclounge

# Install openSSH [yes]

# in case of server install stuck on “curtin command in-target” with “Install Complete!” on top bar
# check by selecting [View Full Log] and if the install is freezed then
# choose “cancel update & reboot”
# (force reboot if needed)

# server is now installed


# open ssh sesssion
# follow the instructions below

 


login pi

# install nano

  1. $ sudo apt install nano

# disable cd-rom release, comment cdrom line in sources list if exists

  1. $ sudo nano /etc/apt/sources.list

#deb [check-date=no] file:///cdrom jammy main restricted

# CTRL X +Y to SAVE

#update distro

  1. $ sudo apt update

#upgrade

  1. $ sudo apt upgrade

# check for update again until All packages are up to date.

# in case of “The following packages have been kept back:”
# force install of left back pkgs

  1. $ sudo apt-get install (list of packages)

# install auto completion

 

  1. $ sudo apt-get install bash-completion

# logout
# reopen ssh sesssion


# add sudoers after installation

 

  1. $ sudo nano /etc/sudoers

# add the line below after root ALL=(ALL:ALL) ALL

user ALL=(ALL:ALL) ALL

# CTRL X +Y to SAVE

  1. $ mkdir Downloads
  1. $ mkdir scripts
  1. $ ls

# hostname

# check hostname should be musiclounge or medialounge
hostnamectl

 

  1. $ sudo nano /etc/hostname

# check host

  1. $ sudo nano /etc/hosts

# disable cloud-init

 

  1. $ sudo touch /etc/cloud/cloud-init.disabled

# Disable all cloud services
# uncheck all except “No-Cloud” on first line

  1. $ sudo dpkg-reconfigure cloud-init

# install samba

# read the dedicated tutorial for more info

  1. $ sudo apt-get install samba samba-common smbclient samba-common-bin smbclient cifs-utils
  1. $ sudo mkdir /mnt/media

ls /mnt/media/

# add your fstab entry

# add your fstab entry to mount your music library to /mnt/media

  1. $ sudo nano /etc/fstab

//192.168.x.x/music /mnt/media cifs username=guest,password=,vers=2.0,uid=1000,gid=1000,dir_mode=0755,file_mode=0755,x-systemd.before=mpd.service,x-systemd.device-timeout=10 0 0

# CTRL X +Y to SAVE

# check mount point

  1. $ sudo systemctl daemon-reload
  1. $ sudo mount -a
  1. $ ls /mnt/media/

# you should see your files otherwise fix fstab (see the instructions above)


# install nginx

# read the dedicated tutorial for more info

  1. $ sudo apt-get install nginx php-curl php-sqlite3 php-gd php-json php-xml php-mbstring php-fpm php-intl imagemagick

# add gzip settings from gzip on

  1. $ sudo nano /etc/nginx/nginx.conf
 gzip on;
 gzip_vary on;
 gzip_buffers 16 8k;
 gzip_comp_level 6;
 gzip_min_length 1000;
 gzip_proxied expired no-cache no-store private auth;
 gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon;
 gzip_disable msie6;
 gzip_http_version 1.1;

# CTRL X +Y to SAVE

# edit defaut settings,

  1. $ sudo nano /etc/nginx/sites-available/default

# replace

location / {
	# First attempt to serve request as file, then
	# as directory, then fall back to displaying a 404.
	try_files $uri $uri/ =404;
}

# with:

location /favicon.ico {
        alias /var/www/html/ml_play.png;
}
location /music {
	alias /mnt/media;
}
location /mympd/ {
	proxy_pass http://127.0.0.1:8080/;
}
location / {
	return 301 http://$host:8080/;
	# First attempt to serve request as file, then
	# as directory, then fall back to displaying a 404.
	try_files $uri $uri/ =404;
}

# CTRL X +Y to SAVE

  1. $ sudo mkdir /var/www/html/tmp
  1. $ sudo usermod -a -G www-data pi
  1. $ sudo chown -R www-data:www-data /var/www
  1. $ sudo chmod -R g+rwX /var/www
  1. $ sudo ln -s /var/www/ ~/www
  1. $ sudo systemctl restart nginx

# add pi to audio and other groups

 

  1. $ sudo usermod -aG adm,dialout,cdrom,sudo,audio,www-data,video,plugdev,games,users,input,render,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

# check ALSA

  1. $ aplay -l

# in case of error or no sound card try

  1. $ sudo aplay -l

# if OK with list of sound cards including your DAC

aplay -l

# if sound card not found install alsa


# INSTALL ALSA if DAC not found

  1. $ sudo apt-get install alsa-utils alsa-tools libasound2
  1. $ sudo systemctl enable 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
  1. $ sudo systemctl start alsa-utils

# check alsa status

  1. $ sudo systemctl status alsa-utils.service
  1. $ sudo reboot

# reopen SSH session

  1. $ aplay -l

# your USB DAC should be in card *1*

# in case your DAC takes (sometime) index zero(0)

  1. $ sudo cat /proc/asound/modules
 0 snd_usb_audio
 1 snd_hda_intel

cat /proc/asound/cards

 0 [MQA ]: USB-Audio - D90 MQA
           Topping D90 MQA at usb-0000:00:14.0-3, high speed
 1 [PCH ]: HDA-Intel - HDA Intel PCH
           HDA Intel PCH at 0xd0710000 irq 96

# just reboot or
# change the usb sound card priority

  1. $ sudo nano /etc/modprobe.d/alsa-base.conf

# add this line

options snd_usb_audio index=-2

# CTRL X +Y to SAVE


# in case of error purge and reinstall ALSA

# alsa-base pkg could be omited if not present in repository

  1. $ sudo dpkg -l alsa*
  1. $ 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

# then GO TO INSTALL ALSA instructions above


# create a simbolic link for backward compatibility with old packages

# which target by default the configuration file in /usr/local/etc/

 

  1. $ ls /usr/local/etc

# result should be empty or not found then type

  1. $ sudo rm -r /usr/local/etc
  1. $ sudo ln -s /etc /usr/local/

# type again

  1. $ ls /usr/local/etc

# now etc/ directory is correctly linked


# install MPD server

  1. $ sudo apt install mpd mpc
  1. $ sudo systemctl daemon-reload
  1. $ sudo systemctl enable mpd
  1. $ sudo systemctl start mpd
  1. $ sudo systemctl status mpd

# check version
mpd -V

# should be => 0.23.12


# optional: compile and install latest MPD

 

# website: https://www.musicpd.org/

# check compiler version
gcc –version

# install gcc if not found (GCC 10 or greater)

  1. $ sudo apt -y install build-essential
  1. $ cd ~/Downloads

# install git if not found

  1. $ sudo apt install git

# clone MPD git (or download latest stable and extract)

  1. $ sudo git clone https://github.com/MusicPlayerDaemon/MPD.git
  1. $ cd MPD/

# install ninja

  1. $ sudo apt-get install ninja-build

# dependencies
#(libboost-dev is only needed for old MPD version)

  1. $ sudo apt install meson g++ \
libfmt-dev \
libpcre2-dev \
libmad0-dev libmpg123-dev libid3tag0-dev \
libflac-dev libvorbis-dev libopus-dev libogg-dev \
libadplug-dev libaudiofile-dev libsndfile1-dev libfaad-dev \
libfluidsynth-dev libgme-dev libmikmod-dev libmodplug-dev \
libmpcdec-dev libwavpack-dev libwildmidi-dev \
libsidplay2-dev libsidutils-dev libresid-builder-dev \
libavcodec-dev libavformat-dev \
libmp3lame-dev libtwolame-dev libshine-dev \
libsamplerate0-dev libsoxr-dev \
libbz2-dev libcdio-paranoia-dev libiso9660-dev libmms-dev \
libzzip-dev \
libcurl4-gnutls-dev libyajl-dev libexpat-dev \
libasound2-dev libao-dev libjack-jackd2-dev libopenal-dev \
libpulse-dev libshout3-dev \
libsndio-dev \
libmpdclient-dev \
libnfs-dev \
libupnp-dev \
libavahi-client-dev \
libsqlite3-dev \
libsystemd-dev \
libgtest-dev \
libboost-dev \
libicu-dev \
libchromaprint-dev \
libgcrypt20-dev 

# meson version => 0.56
meson -v

# configure

  1. $ sudo meson . output/release --buildtype=debugoptimized -Db_ndebug=true -Dsysconfdir=/etc

# check config

  1. $ sudo meson configure output/release

# compile (take a while be patient…)

  1. $ sudo ninja -C output/release

# install

  1. $ sudo ninja -C output/release install

# return home

  1. $ cd ~/

# configure and start MPD daemon

 

  1. $ sudo systemctl daemon-reload
  1. $ sudo systemctl enable mpd

# edit /etc/mpd.conf (copy / paste conf read tutorial)
# mpd is configured with sound card 1 (“hw:1,0”)

 

# backup

  1. $ sudo cp /etc/mpd.conf Downloads/mpd.conf.bak

# clear

  1. $ sudo truncate -s 0 /etc/mpd.conf

# edit

  1. $ sudo nano /etc/mpd.conf

# copy and paste these lines

music_directory "/mnt/media"
playlist_directory "/var/lib/mpd/playlists"
db_file "/var/lib/mpd/tag_cache"
log_file "/var/log/mpd/mpd.log"
# uncomment pid_file if you do not use systemd 
#pid_file "/run/mpd/pid"
state_file "/var/lib/mpd/state"
sticker_file "/var/lib/mpd/sticker.sql"
user "mpd"
group "audio"
bind_to_address "any"
port "6600"
log_level "default"
restore_paused "yes"
#save_absolute_paths_in_playlists "no"
#metadata_to_use "artist,album,title,track,name,genre,date,composer,performer,disc"
#metadata_to_use "+comment"
auto_update "no"
#auto_update_depth "3"
follow_outside_symlinks "yes"
follow_inside_symlinks "yes"
zeroconf_enabled "no"
zeroconf_name "Music DAC"
connection_timeout "120"
#password "password@read,add,control,admin"
#default_permissions "read,add,control,admin"
#
###############################################################################

# Database #######################################################################
#

#database {
# plugin "proxy"
# host "other.mpd.host"
# port "6600"
#}

# Input #######################################################################
#

input {
plugin "curl"
# proxy "proxy.isp.com:8080"
# proxy_user "user"
# proxy_password "password"
}

# QOBUZ input plugin
input {
enabled "no"
plugin "qobuz"
# app_id "ID"
# app_secret "SECRET"
# username "USERNAME"
# password "PASSWORD"
# format_id "N"
}

# TIDAL input plugin
input {
enabled "no"
plugin "tidal"
# token "TOKEN"
# username "USERNAME"
# password "PASSWORD"
# audioquality "Q"
}

# Decoder #####################################################################
#

decoder {
plugin "ffmpeg"
enabled "yes"
# gapless "no"
}

decoder {
plugin "wildmidi"
enabled "no"
}

replaygain "off"
replaygain_preamp "0"
#replaygain_missing_preamp "0"
#replaygain_limit "yes"
volume_normalization "no"
filesystem_charset "UTF-8"

###############################################################################

audio_output {
type "alsa"
name "Default"
device "hw:1,0"
mixer_type "none"
dop "no"
}

audio_output {
type "alsa"
name "ALSA DAC DOP"
device "hw:1,0"
mixer_type "none"
dop "yes"
}

audio_output {
type "alsa"
name "ALSA DAC NoDOP"
device "hw:1,0"
mixer_type "none"
dop "no"
}

audio_buffer_size "4096"
#buffer_before_play "10%"
max_output_buffer_size "131072"
max_connections "128"

audio_output {
type "alsa"
name "ALSA EQ"
device "plug:plugequal"
# format "44100:16:2" # optional
# mixer_device "default" # optional
# mixer_control "PCM" # optional
# mixer_index "0" # optional
}

# optional output to stream music to local device (phone, tablet, pc,...)
audio_output {
type            "httpd"
name            "Local Stream"
encoder         "vorbis"
#encoder        "lame"         # comment vorbis and use lame for iOS support
port            "8000"
quality         "5.0"           # do not define if bitrate is defined
#bitrate        "128"           # do not define if quality is defined
#format          "44100:16:1"
always_on       "yes"           # prevent MPD from disconnecting all listeners when playback
tags            "yes"           # httpd supports sending tags to listening streams.
}

# CTRL + X the Y to SAVE

# start MPD service

  1. $ sudo systemctl restart mpd

# configure smb share points

# (copy/past at the end, read the tutorial)

 

  1. $ sudo nano /etc/samba/smb.conf
[playlists]
path = /var/lib/mpd/playlists
read only = no
public = yes
writable = yes
browseable = yes
guest ok = yes
create mask = 0777
directory mask = 0755
force user = mpd

[music]
path = /mnt/media
read only = no
public = yes
writable = yes
browseable = yes
guest ok = yes
create mask = 0777
directory mask = 0755
force user = mpd

[www]
path = /var/www/html
read only = no
public = yes
writable = yes
browseable = yes
guest ok = yes
create mask = 0777
directory mask = 0755
force user = www-data

[Downloads]
path = /home/pi/Downloads
read only = no
public = yes
writable = yes
browseable = yes
guest ok = yes
create mask = 0777
directory mask = 0755
force user = pi

[scripts]
path = /home/pi/scripts
read only = no
public = yes
writable = yes
browseable = yes
guest ok = yes
create mask = 0777
directory mask = 0755
force user = pi

[sdcard]
path = /home/pi
read only = no
public = yes
writable = yes
browseable = yes
guest ok = yes
create mask = 0777
directory mask = 0755
force user = root

# CTRL + X the Y to SAVE

  1. $ sudo /etc/init.d/smbd restart

# now you have acces to www folder from the network
# download and copy at least the faveicon ( ml_play.png by default)
# and your hmtl files if used
[ml_play.png] image


# Install latest myMPD

  1. $ cd ~/Downloads

# install git if not found

  1. $ sudo apt install git

# clone myMPD git

  1. $ sudo git clone https://github.com/jcorporation/myMPD.git
  1. $ cd myMPD
  1. $ sudo ./build.sh installdeps
  1. $ sudo ./build.sh release
  1. $ sudo ./build.sh install

# myMPD is now installed
# create config files

  1. $ sudo systemd-run -t -p DynamicUser=yes -p StateDirectory=mympd -p CacheDirectory=mympd /usr/bin/mympd -c

# update port 8080

  1. $ sudo nano /var/lib/mympd/config/http_port

# CTRL + X the Y to SAVE

# disable (false) ssl

  1. $ sudo nano /var/lib/mympd/config/ssl

# CTRL + X the Y to SAVE

# optional set log level to ERROR (3) (avoid thousands WARN AlbumArtistSort missing in log)

  1. $ sudo nano /var/lib/mympd/config/loglevel

# CTRL + X the Y to SAVE

# start myMPD

  1. $ sudo systemctl enable mympd
  1. $ sudo systemctl start mympd
  1. $ sudo systemctl status mympd

# return home

  1. $ cd ~/

# ALSA EQ

  1. $ sudo apt-get install libasound2-plugin-equal
  1. $ sudo nano /var/lib/mpd/.asoundrc
pcm.!default {
type plug
slave.pcm plugequal;
}
ctl.!default {
type hw card 0
}
ctl.equal {
type equal;
}
pcm.plugequal {
type equal;
slave.pcm "plughw:1,0"; # NOTE this line MUST be your hardware device.
}
pcm.equal {
type plug;
slave.pcm plugequal;
}

# CTRL + X the Y to SAVE

# check ALSA EQ

  1. $ sudo -H -u mpd alsamixer -D equal

# trigger scripts with a remote control to configure the EQ
# examples
# scripts select automatically the ALSA EQ audio output (see the MPD conf for more info)

  1. $ sudo nano ~/scripts/lowbass.sh
#!/bin/bash
mpc enable only 'ALSA EQ'
sudo -u mpd /usr/bin/amixer -D equal -q set '00. 31 Hz' 39
sudo -u mpd /usr/bin/amixer -D equal -q set '01. 63 Hz' 39
sudo -u mpd /usr/bin/amixer -D equal -q set '02. 125 Hz' 58
sudo -u mpd /usr/bin/amixer -D equal -q set '03. 250 Hz' 58
sudo -u mpd /usr/bin/amixer -D equal -q set '04. 500 Hz' 60
sudo -u mpd /usr/bin/amixer -D equal -q set '05. 1 kHz' 66
sudo -u mpd /usr/bin/amixer -D equal -q set '06. 2 kHz' 66
sudo -u mpd /usr/bin/amixer -D equal -q set '07. 4 kHz' 66
sudo -u mpd /usr/bin/amixer -D equal -q set '08. 8 kHz' 66
sudo -u mpd /usr/bin/amixer -D equal -q set '09. 16 kHz' 66
mpc play

# CTRL + X the Y to SAVE

  1. $ sudo chmod +x ~/scripts/lowbass.sh
  1. $ sudo nano ~/scripts/jbleq.sh
#!/bin/bash
mpc enable only 'ALSA EQ'
sudo -u mpd /usr/bin/amixer -D equal -q set '00. 31 Hz' 66
sudo -u mpd /usr/bin/amixer -D equal -q set '01. 63 Hz' 66
sudo -u mpd /usr/bin/amixer -D equal -q set '02. 125 Hz' 66
sudo -u mpd /usr/bin/amixer -D equal -q set '03. 250 Hz' 60
sudo -u mpd /usr/bin/amixer -D equal -q set '04. 500 Hz' 60
sudo -u mpd /usr/bin/amixer -D equal -q set '05. 1 kHz' 62
sudo -u mpd /usr/bin/amixer -D equal -q set '06. 2 kHz' 66
sudo -u mpd /usr/bin/amixer -D equal -q set '07. 4 kHz' 70
sudo -u mpd /usr/bin/amixer -D equal -q set '08. 8 kHz' 71
sudo -u mpd /usr/bin/amixer -D equal -q set '09. 16 kHz' 66
mpc play

# CTRL + X the Y to SAVE

  1. $ sudo chmod +x ~/scripts/jbleq.sh

# assign pi user:group to all scripts

  1. $ sudo chown $USER:$USER  ~/scripts/*

# Optional: Triggerhappy (remote control management)

 

  1. $ sudo apt-get install triggerhappy -y
  1. $ sudo nano /etc/triggerhappy/triggers.d/triggers.conf
KEY_PLAY 0 mpc play >/dev/null
KEY_STOP 0 mpc stop >/dev/null
KEY_PAUSE 0 mpc toggle >/dev/null
KEY_PLAYPAUSE 0 mpc toggle >/dev/null 
KEY_NEXT 0 mpc next >/dev/null
KEY_PREVIOUS 0 mpc prev >/dev/null
KEY_FASTFORWARD 0 mpc seek +10 >/dev/null
KEY_REWIND 0 mpc seek -10 >/dev/null
KEY_RECORD 0 /home/pi/scripts/./playlist.sh >/dev/null
KEY_LEFTCTRL+KEY_P 0 mpc play >/dev/null
KEY_LEFTCTRL+KEY_S 0 mpc stop >/dev/null
BTN_MIDDLE 0 mpc toggle >/dev/null
BTN_LEFT 0 mpc prev >/dev/null
KEY_LEFTCTRL+KEY_B 0 mpc prev >/dev/null
KEY_LEFTCTRL+KEY_F 0 mpc next >/dev/null
KEY_HOME 0 mpc toggle >/dev/null
KEY_LEFTSHIFT+KEY_B 0 mpc seek -10 >/dev/null
KEY_LEFTSHIFT+KEY_F 0 mpc seek +10 >/dev/null
KEY_NUMERIC_1 0 /home/pi/scripts/./playlist1.sh >/dev/null 
KEY_NUMERIC_2 0 /home/pi/scripts/./playlist2.sh >/dev/null
KEY_NUMERIC_3 0 /home/pi/scripts/./playlist3.sh >/dev/null
KEY_NUMERIC_6 0 /home/pi/scripts/./lowbass.sh >/dev/null
KEY_NUMERIC_9 0 /home/pi/scripts/./jbleq.sh >/dev/null
KEY_NUMERIC_0 0 mpc enable only 1 && mpc play >/dev/null
KEY_0 0 mpc enable only 1 && mpc play >/dev/null
KEY_1 0 /home/pi/scripts/./playlist1.sh >/dev/null 
KEY_2 0 /home/pi/scripts/./playlist2.sh >/dev/null 
KEY_3 0 /home/pi/scripts/./playlist3.sh >/dev/null 
KEY_6 0 /home/pi/scripts/./lowbass.sh >/dev/null
KEY_9 0 /home/pi/scripts/./jbleq.sh >/dev/null

# CTRL + X the Y to SAVE

  1. $ sudo nano /lib/systemd/system/triggerhappy.service

# change in ExecStart line

-–user nobody

# by

-–user root

# CTRL + X the Y to SAVE

  1. $ sudo nano /etc/default/triggerhappy

# comment

#DAEMON_OPTS=""

# uncomment

DAEMON_OPTS="--user root"

# CTRL + X the Y to SAVE

  1. $ sudo systemctl enable triggerhappy
  1. $ sudo systemctl start triggerhappy
  1. $ sudo systemctl status triggerhappy

# optional: playlist scripts

 

  1. $ sudo nano ~/scripts/playlist1.sh
#!/bin/bash
#
# Script to load playlist

echo "start playlist"
mpc stop
mpc clear
mpc enable only 1
mpc load my_classical_albums
mpc random "on"
mpc crossfade 0
mpc play

# CTRL + X the Y to SAVE

  1. $ sudo chmod +x ~/scripts/playlist1.sh
  1. $ sudo nano ~/scripts/playlist2.sh
#!/bin/bash
#
# Script to load playlist
 
echo "start playlist"
mpc stop
mpc clear
mpc enable only 1
mpc load my_jazzy_albums
mpc random "on"
mpc crossfade 0
mpc play

# CTRL + X the Y to SAVE

  1. $ sudo chmod +x ~/scripts/playlist2.sh

# install DLNA

 

  1. $ sudo apt install minidlna -y

# edit conf and chage media_dir and friendly_name

  1. $ sudo nano /etc/minidlna.conf
media_dir=A,/mnt/media
friendly_name=MediaLounge

# CTRL + X the Y to SAVE

  1. $ sudo usermod -a -G minidlna pi
  1. $ sudo systemctl enable minidlna
  1. $ sudo systemctl start minidlna
  1. $ sudo systemctl status  minidlna
  1. $ sudo cat /var/log/minidlna/minidlna.log

# in case of error related to max_userwatches

  1. $ sudo nano /etc/sysctl.conf

# add these lines

fs.inotify.max_user_instances=8192
fs.inotify.max_user_watches=524288

# CTRL + X the Y to SAVE


# install UPNP renderer

 

  1. $ sudo add-apt-repository ppa:jean-francois-dockes/upnpp1
  1. $ sudo apt install upmpdcli -y

# edit conf and chage friendlyname, upnpav and checkcontentformat

  1. $ sudo nano /etc/upmpdcli.conf
friendlyname = MediaLounge
upnpav = 0
checkcontentformat = 0

# CTRL + X the Y to SAVE

  1. $ sudo systemctl enable upmpdcli
  1. $ sudo systemctl start upmpdcli
  1. $ sudo systemctl status upmpdcli

# install Spotify Connect

 

  1. $ sudo apt-get -y install curl && curl -sL https://dtcooper.github.io/raspotify/install.sh | sh
  2.  
  3. # edit conf and chage LIBRESPOT_NAME, LIBRESPOT_BITRATE and LIBRESPOT_DEVICE (with sound card 1)
  1. $ sudo nano /etc/raspotify/conf
LIBRESPOT_NAME="MediaLounge"
LIBRESPOT_BITRATE="160"
LIBRESPOT_DEVICE="plughw:1,0"

# CTRL + X the Y to SAVE

  1. $ sudo systemctl enable raspotify
  1. $ sudo systemctl start raspotify
  1. $ sudo systemctl status raspotify

  1. # AIR PLAY

 

  1. $ sudo apt-get install autoconf automake avahi-daemon build-essential git libasound2-dev libavahi-client-dev libconfig-dev libdaemon-dev libpopt-dev libssl-dev libtool xmltoman
  1. $ cd ~/Downloads/
  1. $ sudo git clone https://github.com/mikebrady/shairport-sync.git

cd shairport-sync

autoreconf -i -f
./configure –with-alsa –with-avahi –with-ssl=openssl –with-systemd –with-metadata

  1. $ sudo make install

# edit conf and chage LIBRESPOT_NAME, LIBRESPOT_BITRATE and LIBRESPOT_DEVICE (with sound card 1)

  1. $ sudo nano /etc/shairport-sync.conf
name="MediaLounge"

output_device="plughw:1,0"

# CTRL + X the Y to SAVE

  1. $ sudo systemctl enable shairport-sync
  1. $ sudo systemctl start shairport-sync
  1. $ sudo systemctl status shairport-sync

# disable pipewire services if exists

  1. systemctl --global stop pipewire
  2. systemctl --global stop pipewire.socket
  3. systemctl --global stop pipewire-media-session
  4. systemctl --global disable pipewire
  1. $ sudo systemctl --global disable pipewire
  1. $ sudo systemctl --global disable pipewire-media-session

# optional reboot

  1. $ sudo reboot

# update music library database

# be patient could take a while if your music library is big…
mpc update

# reopen SSH session

# check the Roon tutorial HERE to install Roon Server if needed

# cleanup pkgs

  1. $ sudo apt clean
  1. $ sudo apt autoremove

# Congrats! the first “Audiophile” part of this distro is ready

# time to enjoy your music and test if the
# audiophile server part is correctly installed.

# browse and play your music from a browser using myMPD
http://medialounge:8080
# or with a MPD client like MALP or DroidMyMPD
# check the remote control
# use a DLNA client VLC or BubbleUPnP to browse and play your music
# check the upnp renderer
# check Spotify by playing your favorite
# song and using MediaLounge Spotify Connect
# check the AirPlay with apple device or TuneBlade on Windows
# and open your Roon client to browse and play you music



# KODI Installation (Ubuntu)



  1. $ sudo apt install software-properties-common
  1. $ sudo add-apt-repository -y ppa:team-xbmc/ppa
  1. $ sudo apt install kodi

# enable power policy for pi user

 

  1. $ sudo nano /etc/polkit-1/localauthority/50-local.d/50-kodi.pkla
[Allow consolekit]
Identity=unix-group:plugdev
Action=org.freedesktop.upower.*;org.freedesktop.consolekit.system.*;org.f?reedesktop.udisks.*
#Action=org.freedesktop.consolekit*
ResultAny=yes
ResultInactive=no
ResultActive=yes

[Allow login1]
Identity=unix-group:plugdev
Action=org.freedesktop.login1*
ResultAny=yes
ResultInactive=no
ResultActive=yes

[Allow Upower]
Identity=unix-group:plugdev
Action=org.freedesktop.upower*
ResultAny=yes
ResultInactive=no
ResultActive=yes

# CTRL + X the Y to SAVE


# create kodi service

 

  1. $ sudo nano /lib/systemd/system/kodi.service
[Unit]
Description = Kodi Media Center
After = remote-fs.target network-online.target
Wants = network-online.target

[Service]
User = pi
Group = pi
Type = simple
ExecStart = /usr/bin/kodi-standalone
Restart = on-abort
RestartSec = 5

[Install]
WantedBy = multi-user.target

# CTRL + X the Y to SAVE

  1. $ sudo systemctl daemon-reload
  1. $ sudo systemctl enable kodi
  1. $ sudo systemctl start kodi
  1. $ sudo systemctl status kodi

# add kodi smb share points at the end of conf

 

  1. $ sudo nano /etc/samba/smb.conf
[kodi]
path = /home/pi/.kodi
read only = no
public = yes
writable = yes
browseable = yes
guest ok = yes
create mask = 0777
directory mask = 0755
force user = pi

[userdata]
path = /home/pi/.kodi/userdata
read only = no
public = yes
writable = yes
browseable = yes
guest ok = yes
create mask = 0777
directory mask = 0755
force user = pi

# CTRL + X the Y to SAVE

  1. $ sudo systemctl restart smbd
  1. $ sudo reboot

# Adding media source to Kodi

 

# IMPORTANT NOTICE for Windows network SMB share in Kodi 20
# make sure to configure your NAS with shared folders using SMB v2 or v3 and with
# access to everyone (no user/pass)

# setup KODI SMB service with minimum version SMBv2 and maximum SMBv3
# browse the network from a PC and check if you have a full access to shared
# folders without needing to enter your credential
# then in Kodi create your movies, TV shows, etc. source points (i.e. //MYSERVER/Video ) with
# a dummy username and password (like username: srcmedia and paswd: srckodi)


# OPTIONAL: create Video and TV Shows folders if you store the media on the server (not recommended)

  1. $ cd ~/
  1. $ mkdir Video
  1. $ mkdir "TV Shows"

# setup HDMI CEC

# do not forget to add the Pulse Heigh CEC adapter ( https://www.pulse-eight.com ) to be able to use the TV remote control even with the Intel NUC which have a poor CEC implementation (you may need to deactivated internal IR Receiver and HDMI CEC in Intel NUC Bios).

# Congrats! The audiophile server and the Kodi Home Theater are ready

# setup the Kodi SYSTEM > AUDIO > and choose the correct number of speakers
# activate the passthrough to take benefit of Dolby, DTS, trueHD, etc.


# install rc6 mce IR remote control with Kodi 20

# by default Kodi manages the RC6 MCE remote control if your usb dongle is installed or the built in extended IR receiver is set in your bios
# unfortunately some essential buttons of the remote control do not work like BACK (KEY_BACK) and OK (KEY_OK) for example. Read the instructions below to fix it.
# open SSH session
# install ir-keytable

  1. $ sudo apt install ir-keytable

# check if remote control is recognized

  1. $ sudo ir-keytable

# result for usb dongle (mceusb)

Found /sys/class/rc/rc0/ with:
        Name: Media Center Ed. eHome Infrared Remote Transceiver (147a:e03e)
        Driver: mceusb
        Default keymap: rc-rc6-mce
        Input device: /dev/input/event6
        LIRC device: /dev/lirc0
        Attached BPF protocols: Operation not supported
        Supported kernel protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp imon rc-mm
        Enabled kernel protocols: lirc rc-6
        bus: 3, vendor/product: 147a:e03e, version: 0x1201
        Repeat delay = 500 ms, repeat period = 125 ms

# example with build IR (cir)

Found /sys/class/rc/rc0/ with:
        Name: ITE8708 CIR transceiver
        Driver: ite-cir
        Default keymap: rc-rc6-mce
        Input device: /dev/input/event4
        LIRC device: /dev/lirc0
        Attached BPF protocols: Operation not supported
        Supported kernel protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp imon rc-mm
        Enabled kernel protocols: lirc rc-6
        bus: 25, vendor/product: 1283:0000, version: 0x0000
        Repeat delay = 500 ms, repeat period = 125 ms

# Important Info are:

 system device: rc0 (Found /sys/class/rc/rc0/)
driver: mceusb or ite-cir
protocol: rc-6

# copy the rc6 mce keymap rc6_mce.toml from /lib/udev/rc_keymaps/ to /etc/rc_keymaps/

  1. $ sudo cp /lib/udev/rc_keymaps/rc6_mce.toml /etc/rc_keymaps/

# edit the keymap to fix it

  1. $ sudo nano /etc/rc_keymaps/rc6_mce.toml

# replace entries 0x800f0412, 0x800f0413, 0x800f0418, 0x800f0422 and 0x800f0423 with:

.
.
0x800f0412 = "KEY_PAGEUP"
0x800f0413 = "KEY_PAGEDOWN"
.
0x800f0418 = "KEY_PLAY"
.
.
0x800f0422 = "KEY_ENTER"
0x800f0423 = "KEY_BACK"

# CTRL+X then Y to save

# edit /etc/rc_maps.cfg to add our custom keymap for mceusb and ite-cir driver

  1. $ sudo nano /etc/rc_maps.cfg

# add these lines at end

mceusb	*			/etc/rc_keymaps/rc6_mce.toml
ite-cir	*			/etc/rc_keymaps/rc6_mce.toml

# CTRL+X then Y to save

# now we are going to create a service to load our keymap at startup

  1. $ sudo nano /etc/systemd/system/rc6mce-ir-keytable.service

# rc-6 protocol and sys/class/rc rc0 is reported and obviously the path to our keymap

[Unit]
Description=RC6 MCE Keymap Fix
After=network.service kodi.service

[Service]
Type=oneshot
ExecStart=/usr/bin/ir-keytable -c -p rc-6 --write=/etc/rc_keymaps/rc6_mce.toml --sysdev=rc0

[Install]
WantedBy=default.target

# CTRL+X then Y to save

# activate the service

  1. $ sudo systemctl enable rc6mce-ir-keytable.service

# start service

  1. $ sudo systemctl start rc6mce-ir-keytable.service

# now the pause, back and OK buttons work and to get info select the item on Kodi and do a long press on OK

# reboot

  1. $ sudo reboot

# to test your remote control or get the correct scancode

  1. $ sudo ir-keytable -t

# UNINSTALL KODI SERVICES

# if for some reason you no longer need the Home Theater service and want to keep the server for the audio system only (in short using it as the MusicLounge server) do the following

  1. $ sudo systemctl stop kodi.services kodi

$ sudo systemctl disable kodi
$ sudo reboot

MusicLounge: Upgrade Server To Editon 2023

Upgrade MusicLounge Server Editon 2021 To Editon 2023

# Important Notice: The image disk of the 2023 edition for Raspberry PI 4, Odroid C4 and amd64 platform are available for download HERE.
#
# follow the instructions below to upgrade your edition 2021 of MusicLounge. The audiophile server must be already installed and operational.
#
# be sure your data partition is resized
# Odroid C4 with Armbian

  1. $ sudo systemctl enable armbian-resize-filesystem
  2. $ sudo reboot

# Raspberry PI 4 with RaspPI OS, simply run raspi-config and select Advanced Options > Expand Filesystem and reboot

  1. $ sudo raspi-config

# expanding your partition during the boot can take a while (depending the size of your SD Card) so be patient,

# at first boot you should see

Usage of /: 71% of 3.7G

# after expansion on 16GB SD Card

Usage of /: 19% of 14G

# for debian amd64 expand your hard drive if needed using gparted on live distro or from desktop PC is easy
# first move the swap sda2 to end and then resize sda1
# click this link to read the tutorial to expand your disk with GParted


# First, ensure your system is up-to-date in it’s current release.
# update unpncli signature
# go to https://www.lesbonscomptes.com/pages/signatures.html
# download lesbonscomptes.gpg and copy to /usr/share/keyrings/

  1. $ cd ~/Downloads/
  2. $ sudo cp lesbonscomptes.gpg /usr/share/keyrings/

# update buster (ed. 2021) pkgs, the distro must be up to date

  1. $ sudo apt update

# now upgrade pkgs, during installation
# keep local smb.conf
# choose the internal hard drive /dev/sda to install grub if needed (and NOT /dev/sda1)
# otherwise select [default=N] reply

  1. $ sudo apt upgrade

# make a full upgrade to be sure

  1. $ sudo apt full-upgrade

# run update again and you should read
# All packages are up to date.

  1. $ sudo apt update

# now update sources list

  1. $ sudo sed -i 's/buster/bullseye/g' /etc/apt/sources.list
  2. $ sudo sed -i 's/buster/bullseye/g' /etc/apt/sources.list.d/*.list

# update to bullseye sources.list with the entries below

  1. $ sudo nano /etc/apt/sources.list
deb http://deb.debian.org/debian bullseye main contrib non-free
deb-src http://deb.debian.org/debian bullseye main contrib non-free
deb http://deb.debian.org/debian bullseye-updates main contrib non-free
deb-src http://deb.debian.org/debian bullseye-updates main contrib non-free
deb http://deb.debian.org/debian bullseye-backports main contrib non-free
deb-src http://deb.debian.org/debian bullseye-backports main contrib non-free
deb http://security.debian.org/debian-security/ bullseye-security main contrib non-free
deb-src http://security.debian.org/debian-security/ bullseye-security main contrib non-free

# check and update upnpcli source list

  1. $ sudo nano /etc/apt/sources.list.d/*
deb [signed-by=/usr/share/keyrings/lesbonscomptes.gpg] http://www.lesbonscomptes.com/upmpdcli/downloads/debian/ bullseye main
deb-src [signed-by=/usr/share/keyrings/lesbonscomptes.gpg] http://www.lesbonscomptes.com/upmpdcli/downloads/debian/ bullseye main
  1. $ sudo apt clean
  2. $ sudo apt update

# IMPORTANT: on any error fix your sources list before going further

# say YES for restarting services automatically
# for all request (i.e. update conf files) during the upgrade say no
[default=N]

  1. $ sudo apt upgrade

# may require to remove gcc 8 base if the command failed during upgrade because of libc6-dev

  1. $ sudo apt-get remove libgcc-8-dev

# for all request during the upgrade say ‘n’
[default=N]
# and obviously keep smb.conf
# make a full upgrade

  1. $ sudo apt full-upgrade

# run update again and you should read
# All packages are up to date.
# otherwise run $ sudo apt full-upgrade AGAIN

  1. $ sudo apt update

# cleanup pkgs

  1. $ sudo apt autoremove -y

# reboot

  1. $ sudo shutdown -r now

# MPD Upgrade
# check the latest release version available on offical website musicpd.org
# for example to download and extract release 0.23.12 in mpd-0.23.12/

  1. $ cd ~/Downloads/
  2. $ sudo wget https://www.musicpd.org/download/mpd/0.23/mpd-0.23.12.tar.xz
  3. $ sudo tar xf mpd-0.23.12.tar.xz

# or get the very latest (unstable dev release) by cloning the MPD git to MPD/

  1. $ sudo git clone https://github.com/MusicPlayerDaemon/MPD.git

# notice: libboost-dev dependency is no longer needed
# read the mpd tutorial to compile and install the latest version of MPD (version 0.23.12 or greater)

# after compilation and installation enable and start the service

  1. $ sudo systemctl enable mpd
  2. $ sudo systemctl start mpd
  3. $ sudo reboot

# check mpd

  1. $ sudo systemctl status mpd

#
# TROUBLESHOUTING
# in case of error (generally occurs within 5s just after playing) :

alsa_output: Decoder is too slow; playing silence to avoid xrun

# adding the following lines to all your audio output in mpd configuration (/etc/mpd.conf) may help
#

buffer_time "200000"
period_time "5084"

#
# edit mpd.conf and scroll to audio output area to add the 2 lines

  1. $ sudo nano /etc/mpd.conf
.
.
.
audio_output {
type "alsa"
name "Default"
device "hw:1,0"
mixer_type "none"
dop "no"
buffer_time "200000"
period_time "5084"
}

audio_output {
type "alsa"
name "ALSA DAC DOP"
device "hw:1,0"
mixer_type "none"
dop "yes"
buffer_time "200000"
period_time "5084"
}
.
.
.

#
# in case of non fatal binding error

server_socket: bind to '0.0.0.0:8000' failed (continuing anyway, because binding to '[::]:8000' succeeded): Failed to bind socket: Address already in use

# a binding already exists due to ipv6, however mpd is running correctly. if you do not need ipv6 support follow these instructions to disable it by using sysctl command and by adding the kernel option ipv6.disable=1 https://www.wikihow.com/Disable-Ipv6-on-Linux
# edit your nginx.conf to remove ipv6 listening by
# commenting listen [::]:80 default_server; on server block

  1. $ sudo nano /etc/nginx/sites-available/default
server {
        listen 80 default_server;
#       listen [::]:80 default_server;

# myMPD Upgrade

  1. $ cd Downloads/

# rename current directory if exists

  1. $ mv myMPD/ myMPD-10.1.7/

# read the myMPD tutorial on website
# to compile and install the latest version of myMPD (version 10.2.0 or greater)
# after compilation and installation generate the config files

  1. $ sudo systemd-run -t -p DynamicUser=yes -p StateDirectory=mympd -p CacheDirectory=mympd /usr/bin/mympd -c

# change port to 8080

  1. $ sudo nano /var/lib/mympd/config/http_port

# deactivate SSL (false)

  1. $ sudo nano /var/lib/mympd/config/ssl

# enable and start service

  1. $ sudo systemctl enable mympd
  2. $ sudo systemctl start mympd
  3. $ sudo reboot

# check

  1. $ sudo systemctl status mympd

# Raspotify Upgrade
# Install latest version of Raspotify on armhf
# before installing purge old version of raspotify

  1. $ sudo apt purge raspotify

# attention on amd64 you need to remove the Raspotify docker image

  1. $ sudo docker stop spot
  2. $ sudo docker rm spot

# list images

  1. $ sudo docker images

# get IMAGE ID and remove it

  1. $ sudo docker rmi IMAGE_ID

# if docker is no longer used you can remove it as well
# for more info see the tutorial on page:
# MusicLounge: Spotify Connect (On amd64 Distro Using Docker)
# docker image is now removed
# to install Raspotify type the following command:

$ sudo apt-get -y install curl && curl -sL https://dtcooper.github.io/raspotify/install.sh | sh

# Edit Raspotify configuration:

  1. $ sudo nano /etc/raspotify/conf

# and change these options only

LIBRESPOT_DEVICE_NAME="MusicLounge"
LIBRESPOT_BITRATE="160"
LIBRESPOT_DEVICE="plughw:1,0"

# CTRL+O to save
# CTRL+X to exit
# now enable and start the service

  1. $ sudo systemctl daemon-reload
  2. $ sudo systemctl enable raspotify
  3. $ sudo systemctl start raspotify
  4. $ sudo reboot

# check the status

  1. $ sudo systemctl status raspotify

#
# TROUBLESHOOTING
#
# in case of warning related to libmdns

WARN  libmdns::fsm] dropping truncated packet from 192.168.x.x:5353

# this error is probably due to a bad implementation of mDNS in your router,
# you may update your router firmware or disable zeroconf (librespot discovery) and
# add your credentials to the Raspotify config
# edit conf and enable credential cache, disable discovery
# add your Spotify username and password

  1. $ sudo nano /etc/raspotify/conf
#LIBRESPOT_DISABLE_CREDENTIAL_CACHE=
...
# Disable zeroconf discovery mode.
LIBRESPOT_DISABLE_DISCOVERY=
...
LIBRESPOT_USERNAME="...."
LIBRESPOT_PASSWORD="...."

# NGINX
# check nginx service

  1. $ sudo systemctl status nginx

# in case of error

nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid argument

# make the following changes:

  1. $ sudo mkdir /etc/systemd/system/nginx.service.d
  2. $ sudo nano /etc/systemd/system/nginx.service.d/override.conf

# enter these lines

[Service]
ExecStartPost=/bin/sleep 0.1

# CTRL + X and Y to SAVE

  1. $ sudo systemctl daemon-reload
  2. $ sudo reboot

# open the ssh session and check the status

  1. $ sudo systemctl status nginx

# check the status of minidlna service

  1. $ sudo systemctl status minidlna

# in case of error related to autofs

/lib/systemd/system/minidlna.service:4: Failed to add dependency on autofs, ignoring: Invalid argument

# edit service to apply this fix

  1. $ sudo nano /lib/systemd/system/minidlna.service

# and replace autofs by autofs.service
# CTRL + X and Y to SAVE

  1. $ sudo systemctl daemon-reload
  2. $ sudo reboot

# check your fstab entry and journalctl (sudo journalctl -f )
# in case of error type:

CIFS VFS: Server 192.168.x.x has not responded in xxx seconds. Reconnecting...

# read carefully the SAMBA tutorial chapter “CIFS Mounts Disconnecting Issue – Read More…” (end of the page)
# otherwise disable the cron job (comment line)

  1. $ sudo nano /etc/cron.d/smb_v1_fix
#*/10 *   *   *   *   root    /home/pi/scripts/smb_v1_fix.sh >/dev/null 2>&1

# in case of dhcpcd error type

dhcpcd.service: Failed to locate executable /usr/lib/dhcpcd5/dhcpcd: No such file or directory

# check if you have an error in the status of the service

  1. $ sudo systemctl status dhcpcd
Failed to start DHCP Client Daemon.

# edit the service
# to change ExecStart command to /usr/sbin/dhcpcd -q -w

  1. $ sudo nano /etc/systemd/system/dhcpcd.service.d/wait.conf
[Service]
ExecStart=
ExecStart=/usr/sbin/dhcpcd -q -w

# restart service and check again the status

  1. $ sudo systemctl daemon-reload
  2. $ sudo systemctl restart dhcpcd
  3. $ sudo systemctl status dhcpcd

# check the status of all other services ( airplay, roon, etc.) should be okay

# Congrats!
# Your MusicLounge audiophile server is fully updated to edition 2023
# now update the music library (database)
# use DroidMyMPD or MALP Android client
# or open your browser with http://musiclounge:8080 (or IP address)
# Enjoy!

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 and uses that section by the overlay_profile variable.

@musiclounge:~ $ sudo nano /media/boot/config.ini
; 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

TROUBLESHOOTING: GENERAL


# TS6

# if MPD doesn’t start type this to get its status

  1. $ sudo systemctl status mpd

# if the error is related to /libavcodec.so.58: undefined symbol: bcm_host_is_fkms_active
# reinstall libraspberrypi0 pkg

  1. $ sudo apt install --reinstall libraspberrypi0
  1. $ sudo reboot

# NANO return this error (on Armbian / Debian):

Unable to create directory /root/.local/share/nano/: No such file or directory It is required for saving/loading search history or cursor positions.

# check if nano cmd is available using:

  1. sudo /bin/nano .bashrc

# if nano opens the file then you simply need to create the /root/.local/share/nano/ directories
# you can confirm the issue by using:

  1. sudo ls -l /root/.local/

# UPGRADE or DOWNGRADE YOUR KERNEL


# IMPORTANT:
# All information below is for Raspberry PI platform only, does not apply to other devices


# go to
https://github.com/Hexxeh/rpi-firmware/commits/master

# get the sha1 of the kernel
# for example: 4.19.118-v7 e1050e94821a70b2e4c72b318d6c6c968552e9a2

# then to install this old kernel 4.19.118-v7+ enter:

  1. $ sudo rpi-install e1050e94821a70b2e4c72b318d6c6c968552e9a2
  1. $ sudo reboot

# install pkg ends with error:
# “Failed to start The PHP 7.3 FastCGI Process Manager”
# type the cmd below to create the missing directory:

  1. $ sudo mkdir /var/run/php

myMPD WEB Client


# STEP15

# install myMPD WEB Client
# use a simple Internet browser with your desktop PC, tablet or phone to play and browse your music library

# install dependencies, compile and install myMPD

  1. cd ~/Downloads/

# install git if the command is not found

  1. sudo apt install git
  1. $ sudo git clone https://github.com/jcorporation/myMPD.git
  2. $ cd myMPD
  3. $ sudo ./build.sh installdeps
  4. $ sudo ./build.sh release

# install

  1. $ sudo ./build.sh install

# configure mympd or update config (new version)
# /etc/mympd.conf is no longer used in recent version, check this link for more info:
# https://jcorporation.github.io/myMPD/configuration/

# to create initial configuration with new version using systemd:

  1. $ sudo systemd-run -t -p DynamicUser=yes -p StateDirectory=mympd -p CacheDirectory=mympd /usr/bin/mympd -c

# to create initial configuration with OLD version of myMPD:

  1. $ sudo mympd -c

# configure http port to 8080
# edit and replace 80 to 8080 and CTRL+X to save

  1. $  sudo nano /var/lib/mympd/config/http_port

# deactivate SSL
# replace true to false and CTRL+X to save

  1. $ sudo nano /var/lib/mympd/config/ssl

# almost all other configuration like deactivate home page
# or auto-generated playlist (AKA myMPD smart playlist)
# are available from mympd web client directly

# ==========================================================
# configure mympd (old version)
# ==========================================================

  1. $ sudo nano /etc/mympd.conf

# change httpport = 80 to

httpport = 8080

# deactivate SSL

ssl = false

# if you want to deactivate home page and auto-generated playlist (AKA myMPD smart playlist)
# add the following in the mympd section

smartpls = false
home = false

# CTRL+O to save
# CTRL+X to exit

# ==========================================================

# activate myMPD service

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

# OPTIONAL reboot

  1. $ sudo reboot

# check the status

  1. $ sudo systemctl status mympd

# open your internet browser firefox or chromium or safari or other
# we already configure the web server nginx (see the corresponding page for more info)

# the ssl certificate is outdated and automatically generated by myMPD, nothing to worry about

# enter the IP of your audio server
http://192.168.XXX.XXX:8080

# Enjoy your music library from any remote device

# visit myMPD repository for more info:
https://github.com/jcorporation/myMPD

# ==========================================================

TROUBLESHOOTING

# if for some reason myMPD fails at startup, it’s almost certainly a permission issue
# due to an upgrade from old version to the recent version of myMPD

mympd.service: Failed to set up special execution directory in /var/cache: File exists


# the new version of myMPD no longer uses a static ‘mympd’ group/user but the
# DynamicUser feature of systemd which automatically attributes the correct user and group
# to all myMPD directories at startup

# to cleanup your installation do the following
# (all cache and configuration files will be deleted)

  1. $ sudo systemctl stop mympd
  2. $ sudo rm -Rf /var/lib/mympd
  3. $ sudo rm -Rf /var/lib/private/mympd
  4. $ sudo rm -Rf /var/cache/private/mympd
  5. $ sudo rm -Rf /var/cache/mympd
  6. $ sudo userdel mympd
  7. $ sudo groupdel mympd

# to create initial configuration with the new version using systemd:

  1. $ sudosystemd-run -t -p DynamicUser=yes -p StateDirectory=mympd -p CacheDirectory=mympd /usr/bin/mympd -c

# now the directories are re-created by myMPD and user/group assigned by systemd,
# configure http port to 8080
# edit and replace 80 to 8080 and CTRL+X to save

  1. $  sudo nano /var/lib/mympd/config/http_port

# deactivate SSL
# replace true to false and CTRL+X to save

  1. $ sudo nano /var/lib/mympd/config/ssl

# reboot

  1. $ sudo reboot

# start myMPD with the correct config and check the status.

  1. $ sudo systemctl start mympd

# if the album cover are not visible in database view, you may try to change the music directory to NONE

# Everything should be okay.

Update MPD Database

 


# STEP14

 

# Congrats! MPD is installed and running!

# First Steps With Music Player Daemon

# it’s now time to update the tag db of MPD, we are using the client this time (mpc):
# type the following cmds to update the MPD database

  1. $ mpc update

# check the status to see if the update is done type:

  1. $ mpc status

# “Updating DB …” shouldn’t be in the status result (can take a while be patient, 1500 albums/19000 songs is about 10mn to be updated)

# loop with

  1. $ mpc status

# until the DB is updated

 


# STEP15

 

  1. $ mpc status

# play songs to check if everything is OKAY! 😉

# follow instructions to install myMPD and open your internet browser and type the hostname (musiclounge) or IP address of your MusicLounge server to use myMPD Web Client
# http://musiclounge:8080 or http://192.168.x.x:8080

# or download our dedicated DroidMyMPD app for Android and start browsing your library and play your favorite song,

# Also, you can install a MPD client on your phone / tablet like MALP for Android ( https://gitlab.com/gateship-one/malp )
# select the correct ALSA audio output
# and to browse your library and enjoy your music!

Click the button NEXT below to continue with optional features like:

# – add a WEB Client to browse/play music from firefox, chrome, safari, edge, …
# – add IR remote control management
# – add DLNA (upnp) server/renderer
# – add Spotify connect
# – add Airplay renderer
# – Roon server/bridge
# – ALSA EQ

Browse your music library with MPD client

Activate MPD


# STEP11

# activate service

  1. $ sudo systemctl enable mpd


# restart MPD

  1. $ sudo systemctl start mpd


# if you have an error in your conf file and MPD didn't start type the following to get the error line:

  1. $ sudo systemctl status mpd


# loop step 10/11 to fix mpd.conf until MPD start correctly without error (see previous step)


# STEP12

# create playlists directory if not exists

  1. $ ls -l /var/lib/mpd/
pi@musiclounge:~$ ls -l /var/lib/mpd/
total 28
drwxr-xr-x 2 root root   4096 Feb 25  2019 music
drwxr-xr-x 2 mpd  audio  4096 Feb 25  2019 playlists
-rw-r--r-- 1 mpd  audio   189 Jun 18 04:37 state
-rw-r--r-- 1 mpd  audio 12288 Jun 18 04:29 sticker.sql
-rw-r--r-- 1 mpd  audio   241 Jun 18 04:41 tag_cache

# SKIP THIS STEP if playlists directory exists (should be already created by MPD installation)

# if the directory does not exist, create it

  1. $ sudo mkdir /var/lib/mpd/playlists


# change user:group if not mpd:audio

  1. $ sudo chown mpd:audio /var/lib/mpd/playlists



# set permission if not already 755

  1. $ sudo chmod 755 /var/lib/mpd/playlists


Click the button NEXT below to continue...

Configure MPD


# STEP10

# YOUR USB DAC MUST BE CONNECTED TO THE USB PORT AND READY

# edit the configuration of MPD with a DAC USB connected but before:

# identify your USB DAC ID (usually card 1):

  1. $ aplay -l

# in case of *No Soundcard Error*, read our tutorial to install ALSA correctly and prepare your Linux distribution

# to list of playback hardware devices (card 0, card 1, car 2….) and to get the index of your USB DAC

# report this index number in the line device “hw:x,0” of all audio output in mpd.conf see below

# the USB DAC should be indexed 1 or 2

# BEWARE if you disable the RASPBERRY PI HDMI port later (see the corresponding howto) the ID of your DAC will certainly change which require to modify mpd.conf audio output as well


# backup default MPD config mpd.conf into our Downloads/ directory

  1. $ sudo cp /etc/mpd.conf ~/Downloads/mpd.conf

# erase the current config and replace with the settings below

  1. $ sudo truncate -s 0 /etc/mpd.conf
  1. $ sudo nano /etc/mpd.conf

# replace with the settings below

# nano shortcut: CTRL + K to cut an entire line
# this settings use USB DAC on card 1 (hw:1,0), change the index accordingly if needed

# copy the lines below and right-click on nano editor to paste
#

music_directory "/mnt/media"
playlist_directory "/var/lib/mpd/playlists"
db_file "/var/lib/mpd/tag_cache"
log_file "/var/log/mpd/mpd.log"
# uncomment pid_file if you do not use systemd 
#pid_file "/run/mpd/pid"
state_file "/var/lib/mpd/state"
sticker_file "/var/lib/mpd/sticker.sql"
user "mpd"
group "audio"
bind_to_address "any"
port "6600"
log_level "default"
restore_paused "yes"
#save_absolute_paths_in_playlists "no"
#metadata_to_use "artist,album,title,track,name,genre,date,composer,performer,disc"
#metadata_to_use "+comment"
auto_update "no"
#auto_update_depth "3"
follow_outside_symlinks "yes"
follow_inside_symlinks "yes"
zeroconf_enabled "no"
zeroconf_name "Music DAC"
connection_timeout "120"
#password "password@read,add,control,admin"
#default_permissions "read,add,control,admin"
#
###############################################################################

# Database #######################################################################
#

#database {
# plugin "proxy"
# host "other.mpd.host"
# port "6600"
#}

# Input #######################################################################
#

input {
plugin "curl"
# proxy "proxy.isp.com:8080"
# proxy_user "user"
# proxy_password "password"
}

# QOBUZ input plugin
input {
enabled "no"
plugin "qobuz"
# app_id "ID"
# app_secret "SECRET"
# username "USERNAME"
# password "PASSWORD"
# format_id "N"
}

# TIDAL input plugin
input {
enabled "no"
plugin "tidal"
# token "TOKEN"
# username "USERNAME"
# password "PASSWORD"
# audioquality "Q"
}

# Decoder #####################################################################
#

decoder {
plugin "ffmpeg"
enabled "yes"
# gapless "no"
}

decoder {
plugin "wildmidi"
enabled "no"
}

replaygain "off"
replaygain_preamp "0"
#replaygain_missing_preamp "0"
#replaygain_limit "yes"
volume_normalization "no"
filesystem_charset "UTF-8"

###############################################################################

audio_output {
type "alsa"
name "Default"
device "hw:1,0"
mixer_type "none"
dop "no"
}

audio_output {
type "alsa"
name "ALSA DAC DOP"
device "hw:1,0"
mixer_type "none"
dop "yes"
}

audio_output {
type "alsa"
name "ALSA DAC NoDOP"
device "hw:1,0"
mixer_type "none"
dop "no"
}

audio_buffer_size "4096"
#buffer_before_play "10%"
max_output_buffer_size "131072"
max_connections "128"

audio_output {
type "alsa"
name "ALSA EQ"
device "plug:plugequal"
# format "44100:16:2" # optional
# mixer_device "default" # optional
# mixer_control "PCM" # optional
# mixer_index "0" # optional
}
# optional output to stream music to local device (phone, tablet, pc,...)
audio_output {
type            "httpd"
name            "Local Stream"
encoder         "vorbis"
#encoder        "lame"         # comment vorbis and use lame for iOS support
port            "8000"
quality         "5.0"           # do not define if bitrate is defined
#bitrate        "128"           # do not define if quality is defined
#format          "44100:16:1"
always_on       "yes"           # prevent MPD from disconnecting all listeners when playback
tags            "yes"           # httpd supports sending tags to listening streams.
}

# CTRL+O to save
# CTRL+X to exit

# OPTIONAL: You can skip this step if a server distribution is installed
# but for desktop distro you have to disable MPD user service
# because you run it as a headless server:

  1. $ sudo rm /etc/xdg/autostart/mpd.desktop
  2. $ sudo systemctl --global disable mpd.service
  3. $ sudo systemctl --global disable mpd.socket

# MPD server is now configured.
# Click NEXT button to activate Music Player Daemon


#
# TROUBLESHOUTING
# in case of error (generally occurs within 5s just after playing) :

alsa_output: Decoder is too slow; playing silence to avoid xrun

# adding the following lines to all your audio output in mpd configuration (/etc/mpd.conf) may help
#

buffer_time "200000"
period_time "5084"

#
# edit mpd.conf and scroll to audio output area to add the 2 lines

  1. $ sudo nano /etc/mpd.conf
.
.
.
audio_output {
type "alsa"
name "Default"
device "hw:1,0"
mixer_type "none"
dop "no"
buffer_time "200000"
period_time "5084"
}

audio_output {
type "alsa"
name "ALSA DAC DOP"
device "hw:1,0"
mixer_type "none"
dop "yes"
buffer_time "200000"
period_time "5084"
}
.
.
.

#
# in case of non fatal binding error

server_socket: bind to '0.0.0.0:8000' failed (continuing anyway, because binding to '[::]:8000' succeeded): Failed to bind socket: Address already in use

# a binding already exists due to ipv6, however mpd is running correctly. if you do not need ipv6 support follow these instructions to disable it by using sysctl command and by adding the kernel option ipv6.disable=1 https://www.wikihow.com/Disable-Ipv6-on-Linux


Control The Volume Good or Bad? - Read More...

# keep a Bit Perfect audio with a control of the volume, possible?
# yes, this is possible but only if this is supported by your USB DAC

# check if hardware volume is supported
# get the card number of your USB DAC
# (should be 1 if you only have 1 DAC connected)

  1. $ aplay -l
pi@musiclounge:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: S9Pro [Hidizs S9Pro], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 1: MQA [D90 MQA], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: SM1ODROIDC4 [SM1-ODROID-C4], device 0: fe.dai-link-0 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: SM1ODROIDC4 [SM1-ODROID-C4], device 1: fe.dai-link-1 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: SM1ODROIDC4 [SM1-ODROID-C4], device 2: fe.dai-link-2 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

# in this example we have 2 DAC connected
# list mixer contents of the device 1

  1. $ amixer --card 1 scontents
 
pi@musiclounge:~$ amixer --card 1
pi@musiclounge:~$

# nothing for the topping D90

# now for the S9 Pro

  1. $ amixer --card 0 scontents
pi@musiclounge:~$ amixer --card 0
Simple mixer control 'PCM',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 127
  Mono:
  Front Left: Playback 127 [100%] [0.00dB] [on]
  Front Right: Playback 127 [100%] [0.00dB] [on]
Simple mixer control 'PCM',1
  Capabilities: pvolume pvolume-joined
  Playback channels: Mono
  Limits: Playback 0 - 127
  Mono: Playback 87 [69%] [-20.00dB]

# great! the hardware volume is supported on this DAC
# now we change the mpd.conf to add this dac with hardware volume control

  1. $ sudo nano /etc/mpd.conf

# add this at the end of your configuration
# hw:0 must changed to corresponding card number of your DAC

audio_output {
type "alsa"
name "Hidizs S9 Pro Mixer ON"
device "hw:0,0"
mixer_type "hardware"
mixer_control "PCM"
mixer_index "0"
dop "no"
}

# CTRL+O to save
# CTRL+X to exit

# that’s it!

# Our recommendation is to avoid using volume control in MPD configuration if
# a physical or integrated volume control is already included with your DAC

# in case you have no support of hardware mixer (volume) in your DAC capabilities
# but still want a “software” control of the volume here is the audio output to add to mpd.conf
# this is obviously not recommended

audio_output {
type "alsa"
name "ALSA Software Volume"
device "hw:1,0"
mixer_type "software"
dop "no"
}


Click the button NEXT below to continue…

Music Player Daemon (MPD) Server


# STEP9

# install MPD (server)and MPC (music player)
# Music Player Daemon (MPD) Info:
# https://www.musicpd.org/

# create a simbolic link for backward compatibility with old version of MPD # which target by default the configuration file in /usr/local/etc/mpd.conf

  1. $ ls /usr/local/etc


# result should be empty or not found then type

  1. $ sudo rm -r /usr/local/etc


  1. $ sudo ln -s /etc /usr/local/


# type again and result should show the files of etc/ directory

  1. $ ls /usr/local/etc

# optional pkg update

  1. $ sudo apt update

# install MPD

  1. $ sudo apt install mpd mpc -y

# Check mpd version

  1. $ mpd -V

# should be 0.21.22 or greater
# if the version is lower then compile and install mpd
# ( version 0.23.12 works really well with Raspberry PI 4 and Odroid C4, latest version works with barbone PC as well )

# our recommendation is to start with the super stable 0.23.12 and later give the latest version of MPD a try.

# you decide, you have the full info here to compile and install MPD, this is one of the benefit to get a full control of your audio server.

Click NEXT button below to skip the compilation of MPD …


COMPILE AND INSTALL MPD - Click To Read More...

# check your gcc version:

  1. $ gcc --version

# if command not found install build-essential package

  1. $ sudo apt -y install build-essential

# skip the gcc install if version is 8.x+ or greater

  1. $ sudo apt install gcc-8-base

# FOR RASPBERRY PI 4 OWNERS:

# on compilation error increase swap file size,
# change default 100 to 1024

  1. $ sudo nano /etc/dphys-swapfile

CONF_SWAPSIZE=1024

# reboot if you change the swap size

  1. $ sudo reboot

# get url archive from https://www.musicpd.org/download.html
# download latest archive mpd-0.23.x.tar.xz into your home directory (Downloads/ for example)
https://www.musicpd.org/download/mpd/0.2X/mpd-0.2X.XX.tar.xz

# be sure to select your /Downloads folder inside your home directory (create the folder Downloads if needed)

  1. cd ~/Downloads

# hyper stable MPD release

  1. $ sudo wget https://www.musicpd.org/download/mpd/0.23/mpd-0.23.12.tar.xz

# extract (replace -version by the version of mpd mpd-0.23.12.tar.xz):

  1. $ sudo tar xf mpd-version.tar.xz

# enter directory:

  1. $ cd mpd-0.23.12

# or get the very latest (unstable dev release) by cloning the MPD git to MPD/

# install git if not found

  1. $ sudo apt install git
  1.  $ sudo git clone https://github.com/MusicPlayerDaemon/MPD.git
  1. $ cd MPD

# install dependencies:

In any case, you need: a C++17 compiler (e.g. GCC 8 or clang 5) Meson 0.49.0 and Ninja Boost 1.58 pkg-config

  1. $ sudo apt-get install ninja-build

# the command below must includes a lot of dev libraries
# be careful to double check it before validation with enter key
#

$ sudo apt install meson g++ \
libfmt-dev \
libpcre2-dev \
libmad0-dev libmpg123-dev libid3tag0-dev \
libflac-dev libvorbis-dev libopus-dev libogg-dev \
libadplug-dev libaudiofile-dev libsndfile1-dev libfaad-dev \
libfluidsynth-dev libgme-dev libmikmod-dev libmodplug-dev \
libmpcdec-dev libwavpack-dev libwildmidi-dev \
libsidplay2-dev libsidutils-dev libresid-builder-dev \
libavcodec-dev libavformat-dev \
libmp3lame-dev libtwolame-dev libshine-dev \
libsamplerate0-dev libsoxr-dev \
libbz2-dev libcdio-paranoia-dev libiso9660-dev libmms-dev \
libzzip-dev \
libcurl4-gnutls-dev libyajl-dev libexpat-dev \
libasound2-dev libao-dev libjack-jackd2-dev libopenal-dev \
libpulse-dev libshout3-dev \
libsndio-dev \
libmpdclient-dev \
libnfs-dev \
libupnp-dev \
libavahi-client-dev \
libsqlite3-dev \
libsystemd-dev \
libgtest-dev \
libboost-dev \
libicu-dev \
libchromaprint-dev \
libgcrypt20-dev 

# reboot maybe required here # check meson version (0.49 minimum)

  1. $ meson -v

# configure:

  1. $ sudo meson . output/release --buildtype=debugoptimized -Db_ndebug=true -Dsysconfdir=/etc

# check configuration:

  1. $ sudo meson configure output/release

# compile (could take a while… ):

  1. $ sudo ninja -C output/release

# install:

# stop mpd in case it’s running

  1. $ sudo systemctl stop mpd
  1. $ sudo ninja -C output/release install

# go to home directory

  1. $ cd ~/

# Congrats! MPD is compiled and installed

Click the button NEXT below to continue…