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 to change order of devices

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

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

MISC: Tips & Tricks


# RANDOM LINUX TIPS & TRICKS


# Get INFO/VERSION

# Raspberry PI model / revision / serial

  1. $ cat /proc/device-tree/model
  1. $ cat /proc/cpuinfo

# SN#:

  1. $ cat /proc/cpuinfo | grep Serial | cut -d ' ' -f 2

# 10000000XXXXXXXX


  1. $ cat /proc/asound/version
  1. $ dpkg -l alsa*

# Kernel version

  1. $ uname -a

# fedora update kernel/system

  1. $ dnf -y update && dnf -y upgrade

# For example, to add the user linuxize to the sudo group you would run the following command:

  1. $ sudo usermod -a -G sudo linuxize

# Configure to boot into Raspbian Desktop

  1. $ sudo raspi-config

# use your arrow keys to navigate to Enable Boot to Desktop and press enter. Select the Desktop login option and press enter.

# Configure to boot into Raspbian Desktop (without raspi-config)

  1. $ sudo update-rc.d lightdm disable

# Raspberry testing repository

# replace buster by testing in /etc/apt/sources.list

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

# # from
# deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
# # to
# deb http://raspbian.raspberrypi.org/raspbian/ bullseye main contrib non-free rpi

  1. $ sudo apt update

# check if process is locked

  1. $ ps aux | grep -i apt

# kill process (replace pid_id by the process ID number)

  1. $ sudo kill pid_id

# check if killed

  1. $ sudo kill -9 pid_id

# Disable DEBIAN 10 GUI:

  1. $ sudo systemctl set-default multi-user.target
  1. $ sudo reboot

To re-enable the GUI:

  1. $ sudo systemctl set-default graphical.target
  1. $ sudo reboot

# activate raspberry pi WIFI

  1. $ sudo raspi-config

# Select “Localisation Options” then select “change WLAN country”

# then enter root

  1. $ sudo su

# generate wpa_passphrase using your SSID and followed by typing the wifi password
# replace YOUR-SSID by the exact name of your wifi network name

  1. $ wpa_passphrase "YOUR-SSID" >> /etc/wpa_supplicant/wpa_supplicant.conf

# check if the configuration is okay

  1. $ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

# should contain something like this:
# the country= must contains a 2 letters ISO 3166-1 of your country code

  1. ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
  2. update_config=1
  3. country=GB
  4. # reading passphrase from stdin
  5. network={
  6. ssid="YOUR-SSID"
  7. psk=47abc8153891372573fc831a0bab0346b07cb900ada28dc52686359cc60ab9e7
  8. }

# network IP info

  1. $ ifconfig

# scan wifi network

  1. $ sudo iwlist wlan0 scan

# power OFF / ON HDMI raspberry pi

# hdmi OFF

  1. $ sudo /opt/vc/bin/tvservice -o

# hdmi ON

  1. $ sudo /opt/vc/bin/tvservice -p

# AMD64 Useful Cmds

# get hostname

  1. $ hostnamectl

# set hostname

  1. $ sudo hostnamectl set-hostname musiclounge
  1. $ sudo nano /etc/hosts

127.0.0.1 localhost
127.0.1.1 musiclounge

# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

  1. $ sudo reboot

# Check your current Ethernet connection speed

# install ethtool utility

  1. $ sudo apt-get install ethtool

# determine the name of your ethernet interface usually eth0 or enp3s0

  1. $ ip a

# get the speed

  1. $ sudo ethtool eth0 | grep -i speed

# get current playback info useful to check if current playback is DSD native (DSD_U32_BE)

  1. $ cat /proc/asound/card*/pcm*p/sub*/hw_params

# in case you have to entry commands from the server console and not from remote PC/SSH session
# you may want to change the keyboard layout
# use the followinf cmd on debian

  1. sudo dpkg-reconfigure keyboard-configuration

TROUBLESHOOTING: Static IP


# TS7

# Static IP not working
# assign IP to eth0 interface

# configure a static IP address by adding the following to /etc/dhcpcd.conf:

  1. $  ip link show

# ON RASPBERRY PI

  1. 1: lo:  mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
  2. 2: eth0:  mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
  3. 3: wlan0:  mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000

# eth0 is your default interface (Ethernet connection), do not use wifi for your audio server

# ON AMD64 PC

  1. 1: lo:  mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
  2. 2: enp3s0:  mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
  3. 3: wlp2s0:  mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000

# enp3s0 is your default interface (Ethernet connection), do not use wifi for your audio server

# type:

  1. $ sudo nano /etc/network/interfaces

# add those lines at end:

  1. auto lo eth0
  2. iface lo inet loopback
  3.  
  4. iface eth0 inet static
  5.     address 192.168.x.x
  6.     netmask 255.255.255.0
  7.     network 192.168.x.x
  8.     gateway 192.168.x.x

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

  1. $ sudo nano /etc/resolv.conf

# add one or 2 lines (change IP to your DNS address or your router)

  1. nameserver 192.168.x.x
  2. nameserver x.x.x.x

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

  1. $ sudo reboot

# OPTIONAL AND NOT RECOMMENDED
# stop dhcpcd service when the static ip is valid and reachable only

  1. $ sudo systemctl stop dhcpcd

# restart network

  1. $ sudo systemctl restart networking

# get the status (you may lose your ssh session see below)

  1. $ sudo systemctl status networking

# if everything okay reboot your system

  1. $ sudo reboot

# or type this cmd below with interface name (eth0 or enp3s0 ) and reboot manually

  1. $ sudo ifdown enp3s0

# here you’re loosing your SSH session obviously
# see troubbleshooting if static IP not working
# reboot system
# and start the NEW SSH SESSION WITH YOUR NEW STATIC IP! 😉

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

TROUBLESHOOTING: Raspberry PI 3B+


# IMPORTANT FOR RASPBERRY PI OWNERS:
# It’s strongly recommended to create your audio server on Raspberry PI 4 2Go
# The raspberry pi 3 share the same controller with USB and Ethernet which is not good for an audiophile server
# do not expect to use native DSD with RPI 3 using an usb dac…


# ALL INFORMATION BELOW ARE FOR RPI 3B + ONLY, does not apply to other devices


# Apply patch one by one in this order, reboot and check before


# TS1

# APPLY IF NEEDED ONLY (sound drop/loss)

# Ethernet drops Fix (Recommended for Raspberry PI 3B+ only do not apply to RPI 4)
# identify the name of your Ethernet connection (usually eth0 or enp3s0)

  1. $ ip a

# edit rc.local to run a cmd at startup

  1. $ sudo nano /etc/rc.local

# enter this cmd below to optimize your ethernet connection
# see the Tips & Tricks section to install ethtool (sudo apt-get install ethtool) if needed
# add this line at end of rc.local

  1. $ sudo ethtool -s eth0 speed 100 duplex full

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

  1. $ sudo reboot

# TS2

# APPLY IF NEEDED ONLY

# optimize perf for Raspberry PI 3B+ – cpu gouvernor (not recommended for PI4)

# check cpu governor

  1. $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

# set to “performance” at startup

  1. $ sudo mv /etc/init.d/raspi-config /etc/init.d/raspi-config.bak
  1. $ sudo nano /etc/init.d/raspi-config

# copy/paste this script

#!/bin/sh
### BEGIN INIT INFO
# Provides: raspi-config
# Required-Start: udev mountkernfs $remote_fs
# Required-Stop:
# Default-Start: S 2 3 4 5
# Default-Stop:
# Short-Description: Switch to performance/ondemand cpu governor based on shift key pressed.
# Description:
### END INIT INFO
 
# . /lib/lsb/init-functions
 
case "$1" in
start)
log_daemon_msg "Checking if shift key is held down..."
SYS_CPUFREQ_GOVERNOR=/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
if [ -x /usr/sbin/thd ] && timeout 1 thd --dump /dev/input/event* | grep -q "LEFTSHIFT\|RIGHTSHIFT"; then
printf "Yes. Switching to ondemand scaling governor."
if [ -e $SYS_CPUFREQ_GOVERNOR ]; then
echo "ondemand" > $SYS_CPUFREQ_GOVERNOR
echo 50 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
echo 100000 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate
echo 50 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
fi
log_end_msg 0
else
printf "No. Switching to performance scaling governor."
if [ -e $SYS_CPUFREQ_GOVERNOR ]; then
echo "performance" > $SYS_CPUFREQ_GOVERNOR
fi
log_end_msg 0
fi
;;
stop)
;;
restart)
;;
force-reload)
;;
*)
echo "Usage: $0 start" >&2
exit 3
;;
esac

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

# set permission to exec

  1. $ sudo chmod 755 /etc/init.d/raspi-config
  1. $ sudo reboot

# type to check:

  1. $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

# result must be:

# performance


# TS3

# APPLY IF NEEDED ONLY

# USB dropped frames Fix (not recommended for PI 4)

  1. $ sudo nano /etc/rc.local

# # USB fix

  1. $ sudo sed -i "s/console=serial0,115200/net.ifnames=0 dwc_otg.fiq_enable=1 dwc_otg.fiq_fsm_enable=1 dwc_otg.fiq_fsm_mask=0xF dwc_otg.nak_holdoff=1 console=serial0,115200/" /boot/cmdline.txt

# # revert value

  1. $ sudo sed -i "s/net.ifnames=0 dwc_otg.fiq_enable=1 dwc_otg.fiq_fsm_enable=1 dwc_otg.fiq_fsm_mask=0xF dwc_otg.nak_holdoff=1 //" /boot/cmdline.txt

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

  1. $ sudo reboot

MusicLounge: Introduction


# BUILDING THE MUSICLOUNGE AUDIOPHILE SERVER


# STEP1

# A minimum knowledge in shell/bash (typing commands on a terminal using a SSH session with putty for example) is required.
# Internet is your friend! the scope of this project is not to teach linux or how to create a bootable SDCARD from an image file or how to use a SSH session to manage your server wiressly or how to type a command in a shell. 😉
# Simply read carefully instructions and double-check them before applying and everything will be fine.

# the MusicLounge Audiophile Server is reliable and daily used since a while now (more than a decade) and works flawlessly.

# the storage must be already done (see previous post if not ready)

# insert the SD card or USB stick inside the device (Raspberry PI 4, NUC, Ordroid C4, …)

# connect the device to your LAN network using the Ethernet cable (NOT WIFI)

# connect your USB cable from your USB DAC to the device
# (Connecting the usb dac to a powered usb hub maybe required)

# connect your power supply (3A minimum for rPI4 – linear regulated if possible)

# Boot your device!

Click the button NEXT below to continue…

 

GETTING STARTED WITH MUSICLOUNGE DISTRO


GETTING STARTED WITH MUSICLOUNGE AUDIOPHILE DISTRO


IMPORTANT:
Linux Kernel v4.19.64 or greater is needed to play native DSD, check the kernel version of your Linux distro before building our audiophile server.

ODROID C4 BOARD
# for Odroid C4 take the Armbian distro preferably as the Official Hardkernel Ubuntu distro is outdated.
https://www.armbian.com/odroid-c4/#kernels-archive-all

RASPBERRY PI 4
Download Raspberry Pi OS Lite (32Bit)
Minimal image based on Debian 11 bullseye OS for Raspberry
https://www.raspberrypi.org/software/operating-systems/

INTEL and AMD PC (AMD64)
Download Ubuntu 20.04.2 (Jammy) live server for amd64 which have a 6.03 kernel version
or Debian 11 Bullseye Netinst or Standard for amd64 with kernel version 5.15+
Minimal image amd64 (64 Bit) based for INTEL and AMD PC (NUC, PC, BRIX,…)
https://releases.ubuntu.com/jammy/
https://www.debian.org/releases/bullseye/

OTHERS DEVICES
Download Armbian Focal or Buster (Debian Buster 64Bit based) Lite for arm64
Minimal image based on Debian Buster 10 OS for a lot of boards using ARM
# armbian buster headless
https://www.armbian.com/download/


# Our MusicLounge Audiophile server distribution is provided for your convenience. The MusicLounge Audio Server is strictly based on the following distributions on which we have applied all the instructions provided on our website in order to make your job easier, however we strongly suggest to read our tutorials to get a full control on your audio system and customize your installation.

# Edition 2023

# for the Odroid C4 arm64
# Armbian 22.11.4 Jammy core with Linux Kernel 6.0.13-meson64
https://www.armbian.com/odroid-c4/
Sour code: https://github.com/armbian

# for the Raspberry PI 4 armhf (32 Bit)
# Raspberry Pi OS Lite (bullseye) with Linux 5.15 – https://www.raspberrypi.org/software/operating-systems/
# Source code: https://github.com/raspberrypi

# for barebone x64 PC on amd64 platform (Intel NUC, Brix, …) we recommend Debian or
# Debian 11 NETINSTALL or standard https://www.debian.org/CD/http-ftp/#mirrors
# debian-live-11.6.0-amd64-netinst.iso or debian-live-11.6.0-amd64-standard.iso
# Source code: https://github.com/Debian


# Edition 2021

# for the Odroid C4
Sour code: https://github.com/armbian

# for the Raspberry PI 4
# Source code: https://github.com/raspberrypi

# for any barebone PC (Intel NUC, Brix, …)
# Source code: http://cdimage.ubuntu.com/releases/20.04/release/source/


# use “Win32 Disk Image” on Windows to create the SDCARD (8GB)
https://sourceforge.net/projects/win32diskimager/

# use rufus for creating a bootable usb stick with amd64 linux (Intel PC/NUC, Brix,…)
https://rufus.ie/en_US/#

# Notepad++ powerful text editor
https://notepad-plus-plus.org/downloads/

# on barebone PC with internal SSD use HDD Raw Copy 1.10+ Portable from HDGuru.com to clone the img to the SSD


Before going further, the info below is required:
– your gateway / router (internet box) / DNS IP address are required (192.168.x.x)
– if you’re not planning to store musics locally, the ip of your NAS or server PC with the sharing directory containing the music files is required (192.168.x.x)


# VERY IMPORTANT – SSH ON RASPBERRY PI

# RPI4 only: add a empty file named “ssh” without extension (an empty file created with Notepad++ for example) to activate SSH at startup

# RPI4 only: edit cmdline.txt with notepad++ for example and add net.ifnames=0 at the beginning


# Quick Overview:

# create the SDCard with raspiOS or debian lite or armbian or Odroid Ubuntu minimal distro (see the link above)

# DO NOT INSTALL Any Graphics Desktop Environments (GUI), we are building a HEADLESS server…

# insert the SD card inside the device

# connect device to your LAN network using the Ethernet cable

# connect your USB cable from your USB DAC to the device
(for raspberry pi 3b+ connect the usb dac to a powered usb hub and usb hub to the raspberry pi)

# connect your power supply (3A minimum for rPI 4, linear regulated power supply is better)

# Boot your device, start an ssh session from a remote PC and follow our tutorials to install and setup your audiophile server.

Click the button NEXT below to continue…

MUSICLOUNGE AUDIO DISTRO SYSTEM/SOFTWARE REQUIREMENTS

 

SYSTEM/SOFTWARE REQUIREMENTS

  • internet connection (for grabbing/installing packages/updates)
  • a working LAN network with a router/internet-box (gateway)
  • a music library on local disk or on an USB Hard Drive or a shared directory on your LAN network with all your music files, could be a PC with a shared folder or a NAS with SMB server activated (Windows/Mac file sharing server)
  • PC desktop/Laptop connected to the LAN (all commands are sent to the Raspberry PI from this PC using ssh)
  • a Raspberry PI 4 or Odroid C4 or Intel NUC or Others
    The Raspberry PI 3B+ IS NOT RECOMMENDED, add an external powered USB 2.0 hub if you still want to build it with RPI3). For more info read the Raspberry PI benchmark of USB and Ethernet available here: https://magpi.raspberrypi.org/articles/raspberry-pi-4-specs-benchmarks

    The device must be connected to the LAN with Ethernet cable.
    IMPORTANT: WiFi and Bluetooth are NOT recommended and NOT supported in this server installation, a server must be hard wired to your router with an Ethernet cable

  • USB DAC connected to USB to the device (to the powered usb hub with rPI 3b+)
  • SDCARD, mini SSD or usb stick (8GB is enough)

Software

  • MPD music player software to control your audio server and browse your music library (included),
    myMPD to control your music library with an internet browser (included),
    DroidMyMPD for Android app to control your music library from your tablet or smartphone (free app available for download here),
    MALP is also recommended for Android, MaximumMPD can be used on iOS (untested)
  • putty.exe is required on Windows, terminal on others for the SSH session
  • tool for building SD CARD or USB bootable stick (Win32DiskImager or Rufus on Windows for example)

Optional Features

  • remote control management (including play/stop/go next/prev/random/load default playlist… )
  • real time EQ (ALSAEQ plugin)
  • DLNA (Upnp) Media server music player/server ( control audio from Upnp music player or listen music from upnp media server)
  • Spotify account (listen music from Spotify Connect)
  • Airplay device (listen music from Apple devices)
  • Squeezelite player (squeezelitebox for using with LMS player)
  • Roon system

Click the button NEXT below to continue…

MUSICLOUNGE AUDIO DISTRO TERMS AND CONDITIONS OF USE

TERMS AND CONDITIONS OF USES

LICENSE:
instructions bellow are under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)

Read the terms & conditions of uses here (English):
https://creativecommons.org/licenses/by-nc-sa/4.0/

DISCLAIMER:
Neither the author nor any of its providers of information shall have any liability for the accuracy of the information contained in the Service, or for delays or omissions therein. None of the foregoing parties shall be liable for any third-party claims or losses of any nature, including, but not limited to, lost profits, punitive or consequential damages.
The information provided within these pages is not guaranteed to be accurate, nor does the management take responsibility for it. The information comes from other sources and therefore may be wholly unreliable, and the management does not guarantee its suitability for any purpose.
Although the information contained herein may be completely useless, all rights are retained by their respective owners, including, but not limited to, the right of reproduction, the right of distribution, and the right of passage.
the author specifically disclaims any implied warranties or merchantability or fitness for any particular purpose and shall in no event be liable for any loss of profit or any other commercial damage, including but not limited to special, incidental, consequential, or other damages, even if advised of the possibility of such damages.

These instruction are subject to change without notice

by using these instructions below you fully understand and agree with the terms and conditions.

Click the button NEXT below to continue…