# we assume you have a PC with Windows system and 7zip (or Winrar) installed
# and GParted Live USB stick bootable
# more info on GParted website to create your a bootable Live system)
# and another USB drive for the image disk
WINDOWS PC
# download the distribution from our website/github and extract it with 7zip (or Winrar)
# insert your USB drive and format it using NTFS with for example ‘imgdisk’ name
# then copy the extracted image disk (.img) from Windows to your USB drive
# optional: rename image disk to musiclounge.img or medialounge.img
BAREBONE PC (HTPC)
# insert the the GParted Live USB, the imgdisk usb stick, plug a keyboard (and optionally a mouse)
# and turn the HTPC ON
# quickly hit F10 (NUC) or F12 to show up the boot menu
# boot UEFI:disk corresponding to GParted live USB
# GParted app should be opened so you can identify easily
# your internal hard drive (/dev/sda) and your USB stick ‘imgdisk’ (/dev/sdX)
# in our example:
internal hard drive (ssd): /dev/sda
imgdisk partition 1: /dev/sdb1
# QUIT GParted app
# open terminal with root permissions
# mount your usb imgdisk
$ mount/dev/sdX /media
$ cd/media
$ ls
# IMPORTANT: check the integrity of the image disk
$ sha1sum medialounge....img
# compare the result with the SHA1 line on website
# if this doesn’t match then your image disk is corrupted, you can’t go further until your img disk is clean
# clone from image disk to your internal disk (/dev/sda)
# ALL DATA IN INTERNAL HARD DRIVE/SSD WILL BE ERASED
# download the distribution from our website/github and extract it with 7zip or Winrar
# IMPORTANT: check the integrity of the image disk
# and compare the result with the corresponding SHA256 line on website
# run powershell (i.e. Windows Terminal) and type:
Get-FileHash C:\path\to\imagedisk.img
# if this doesn’t match then your image disk is corrupted, you can’t go further until your img disk is clean
# connect your SSD (or 2.5″ Hard drive) to your PC with the Startech USB3 To SATA adapter
# then run Rufus and select the image disk, tick the “List USB Hard Drives” and select your SSD
# clone from image disk to your internal disk
#ALL DATA IN INTERNAL HARD DRIVE/SSD WILL BE ERASED
# After the cloning, close Rufus, disconnect the adapter cable from the PC and mount the SSD inside your Barebone PC/NUC
BAREBONE PC (HTPC)
# insert the the GParted Live USB, plug a keyboard (and optionally a mouse)
# and turn the HTPC ON
# quickly hit F10 (NUC) or F12 to show up the boot menu
# boot UEFI:disk corresponding to GParted live USB
# GParted app should be opened so you can identify easily
# your internal hard drive (/dev/sda)
# Fix the GPT backup header/table if GParted prompts to do so
# resize the root partition of your internal disk (/dev/sda3)
# double-check and APPLY all changes
# expand partition 3 (minimum 16GB)
# shutdown your HTPC
# remove both GParted live usb
# congrats! You are now ready to enjoy your distribution
# 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
$ sudo apt installnano
# disable cd-rom release, comment cdrom line in sources list if exists
$ sudonano/etc/apt/sources.list
#deb [check-date=no] file:///cdrom jammy main restricted
# CTRL X +Y to SAVE
#update distro
$ sudo apt update
#upgrade
$ 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
$ sudoapt-get install(list of packages)
# install auto completion
$ sudoapt-get install bash-completion
# logout # reopen ssh sesssion
# add sudoers after installation
$ sudonano/etc/sudoers
# add the line below after root ALL=(ALL:ALL) ALL
user ALL=(ALL:ALL) ALL
# CTRL X +Y to SAVE
$ mkdir Downloads
$ mkdir scripts
$ ls
# hostname
# check hostname should be musiclounge or medialounge hostnamectl
$ sudonano/etc/hostname
# check host
$ sudonano/etc/hosts
# disable cloud-init
$ sudotouch/etc/cloud/cloud-init.disabled
# Disable all cloud services # uncheck all except “No-Cloud” on first line
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
$ sudomkdir/var/www/html/tmp
$ sudo usermod -a-G www-data pi
$ sudochown-R www-data:www-data /var/www
$ sudochmod-R g+rwX /var/www
$ sudoln-s/var/www/ ~/www
$ sudo systemctl restart nginx
# add pi to audio and other groups
$ 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
$ sudo usermod -aG adm,dialout,cdrom,sudo,audio,www-data,video,plugdev,games,users,input,render,netdev,gpio,i2c,spi pi
# check ALSA
$ aplay-l
# in case of error or no sound card try
$ sudoaplay-l
# if OK with list of sound cards including your DAC
# edit /etc/mpd.conf (copy / paste conf read tutorial) # mpd is configured with sound card 1 (“hw:1,0”)
# backup
$ sudocp/etc/mpd.conf Downloads/mpd.conf.bak
# clear
$ sudo truncate -s0/etc/mpd.conf
# edit
$ sudonano/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
$ sudo systemctl restart mpd
# configure smb share points
# (copy/past at the end, read the tutorial)
$ sudonano/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
$ 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
# optional set log level to ERROR (3) (avoid thousands WARN AlbumArtistSort missing in log)
$ sudonano/var/lib/mympd/config/loglevel
# CTRL + X the Y to SAVE
# start myMPD
$ sudo systemctl enable mympd
$ sudo systemctl start mympd
$ sudo systemctl status mympd
# return home
$ cd ~/
# ALSA EQ
$ sudoapt-get install libasound2-plugin-equal
$ sudonano/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
$ 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)
# 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
$ sudo apt clean
$ 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
[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
$ sudo systemctl daemon-reload
$ sudo systemctl enable kodi
$ sudo systemctl start kodi
$ sudo systemctl status kodi
# add kodi smb share points at the end of conf
$ sudonano/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
$ sudo systemctl restart smbd
$ 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)
$ cd ~/
$ mkdir Video
$ 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
$ sudo apt install ir-keytable
# check if remote control is recognized
$ 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
# 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
$ sudo reboot
# to test your remote control or get the correct scancode
$ 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
# Armbian and Raspi OS come with a nice utility to expand your partition (read the Musiclounge installation for more info) but what about Debian/Ubuntu? # for this distro you need to do it manually but don’t worry
# with the great GParted it’s very easy
# grab the gparted live iso, make a bootable sd card or usb stick to expand your hard drive https://gparted.org/livecd.php
# so you already created your image disk of MusicLounge audiophile server for amd64 on hard drive, usb stick or SD card
# boot with GParted Live USB key and run GParted (the software should startup automatically)
# select on top-right menu your musiclounge device disk (here it’s /dev/sdc)
# in edition 2023 the root partition is the last. # so it is very easy, unmount root partition and expand it
# may need to fix the GPT table backup due to the different size of the hard drive.
# if GPT partions table is corrupted, open terminal and fix gpt with
# assuming it is on /dev/sda disk
$ sudo sgdisk -e/dev/sda
# that’s it! # your MusicLounge Audiophile Server distro is now ready
# however if your root partition is before the swap do the following
# right-click the main partition to unmount musiclounge device
# click the swap partition and right-click to select Resize/Move
# select Align To Cylinder and # move the partition to the end (or put zero in free space following) # then click Resize/Move button
# click the main partition and right-click to select Resize/Move
# resize the partition to the end # then click Resize/Move button
# apply changes
# that’s it! # your MusicLounge Audiophile Server distro is now ready
# cloning large UEFI image disk (5GB+) from Windows to internal hard drive (or SSD) may cause of corrupt installation # also due to GPT structure, cloning to another disk is not enough, you need to rewrite the GPT backup header/table on the last 33 sectors of your target disk # finally you really need to resize the root partition to get enough space for using the distribution
# here are the instructions to make this from Windows and with GParted Live on Linux side.
SOLUTION 1 Requirements
This way is very easy but requires to remove the hard drive/SSD from the Barebone PC/NUC and a special USB3.0 to SATA adapter cable (ref. USB3S2SAT3CB from StartTech).
Windows PC with Rufus and 7-Zip (or Winrar) Installed 1 USB Drive with Bootable GParted Live
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
$ sudo systemctl enable armbian-resize-filesystem
$ sudo reboot
# Raspberry PI 4 with RaspPI OS, simply run raspi-config and select Advanced Options > Expand Filesystem and reboot
$ sudo raspi-config
# expanding your partition during the boot can take a while (depending the size of your SD Card) so be patient,
# 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/
$ cd ~/Downloads/
$ sudocp lesbonscomptes.gpg /usr/share/keyrings/
# update buster (ed. 2021) pkgs, the distro must be up to date
$ 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
$ sudo apt upgrade
# make a full upgrade to be sure
$ sudo apt full-upgrade
# run update again and you should read
# All packages are up to date.
# update to bullseye sources.list with the entries below
$ sudonano/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
$ sudonano/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
$ sudo apt clean
$ 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]
$ sudo apt upgrade
# may require to remove gcc 8 base if the command failed during upgrade because of libc6-dev
$ sudoapt-get remove libgcc-8-dev
# for all request during the upgrade say ‘n’
[default=N]
# and obviously keep smb.conf
# make a full upgrade
$ sudo apt full-upgrade
# run update again and you should read
# All packages are up to date.
# otherwise run $ sudo apt full-upgrade AGAIN
$ sudo apt update
# cleanup pkgs
$ sudo apt autoremove -y
# reboot
$ 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/
# 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
$ sudo systemctl enable mpd
$ sudo systemctl start mpd
$ sudo reboot
# check mpd
$ 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
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=1https://www.wikihow.com/Disable-Ipv6-on-Linux
# edit your nginx.conf to remove ipv6 listening by
# commenting listen [::]:80 default_server; on server block
$ sudonano/etc/nginx/sites-available/default
server {
listen 80 default_server;
# listen [::]:80 default_server;
# myMPD Upgrade
$ cd Downloads/
# rename current directory if exists
$ 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
# Raspotify Upgrade
# Install latest version of Raspotify on armhf
# before installing purge old version of raspotify
$ sudo apt purge raspotify
# attention on amd64 you need to remove the Raspotify docker image
$ sudo docker stop spot
$ sudo docker rm spot
# list images
$ sudo docker images
# get IMAGE ID and remove it
$ 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:
# CTRL+O to save
# CTRL+X to exit
# now enable and start the service
$ sudo systemctl daemon-reload
$ sudo systemctl enable raspotify
$ sudo systemctl start raspotify
$ sudo reboot
# check the status
$ 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
# 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!
The trick here is to keep dtparam=audio=on (native headphone) to shift Hifiberry DAC to card number 1 to be dirrectly compatible with MusicLounge audio server settings.
if card number is different go HERE to reconfigure MPD and other audio services
and if you use the alsa equalizer plugin do not forget to change the plughw id in .asoundrc, see the tutorial here
here is a basic setup of the mpd output audio for hifiberry dac
audio_output {
type "alsa"
name "Hifiberry"
device "hw:1,0"
mixer_type "hardware"
mixer_control "Digital"
mixer_device "hw:1"
mixer_index "0"
dop "yes"
}
2- HIFI SHIELD 2 AND ODROID C4
Make sure the board is correctly connected to the C4 and to the power supply ( more info available HERE ).
# Edit /media/boot/config.ini to edit the DTBO settings. Open that file and find the part shown below. The below settings different from the default, it adds a new section named overlay_hifishield (C2) or overlay_hifishield2 (C4) and uses that section by the overlay_profile variable.
# 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
$ sudo apt update -y
$ 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
~# su - root
~# apt install sudo
~# usermod -aG sudo pi
# after the first boot add user pi to sudoers on Debian
$ su - root
$ 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
exit
# install ssh server
# not needed on debian netinstall distro as you normally install SSH server during the installation process
$ sudo apt install openssh-server -y
# active service
$ sudo systemctl start ssh
$ sudo systemctl enablessh
# 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
$ sudonano/etc/default/grub
# and modify the parameters of GRUB_CMDLINE_LINUX_DEFAULT and GRUB_CMDLINE_LINUX to
# 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
”
# check the status again everything should be okay
$ 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:
$ 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
$ sudo usermod -aG adm,dialout,cdrom,sudo,audio,www-data,video,plugdev,games,users,input,netdev pi
# for Raspberry PI add gpio i2c spi
$ sudo usermod -aG adm,dialout,cdrom,sudo,audio,www-data,video,plugdev,games,users,input,render,netdev,gpio,i2c,spi pi
$ groups pi
# reboot, login pi (skip this step if you are already logged in as pi user)
$ 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
# For example, to add the user linuxize to the sudo group you would run the following command:
$ sudo usermod -a-Gsudo linuxize
# Configure to boot into Raspbian Desktop
$ 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)
$ sudo update-rc.d lightdm disable
# Raspberry testing repository
# replace buster by testing in /etc/apt/sources.list
$ sudonano/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
$ sudo apt update
# check if process is locked
$ ps aux |grep-i apt
# kill process (replace pid_id by the process ID number)
$ sudokill pid_id
# check if killed
$ sudokill-9 pid_id
# Disable DEBIAN 10 GUI:
$ sudo systemctl set-default multi-user.target
$ sudo reboot
To re-enable the GUI:
$ sudo systemctl set-default graphical.target
$ sudo reboot
# activate raspberry pi WIFI
$ sudo raspi-config
# Select “Localisation Options” then select “change WLAN country”
# then enter root
$ sudosu
# 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
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
$ sudo reboot
# Check your current Ethernet connection speed
# install ethtool utility
$ sudoapt-get install ethtool
# determine the name of your ethernet interface usually eth0 or enp3s0
$ ip a
# get the speed
$ sudo ethtool eth0 |grep-i speed
# get current playback info useful to check if current playback is DSD native (DSD_U32_BE)
$ 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
# if you intend to create a multi-room audiophile configuration sharing the same music library on your LAN network
# Use the script below to configure your audio server very easily.
# change the hostname manually
$ sudonano/etc/hosts
$ sudonano/etc/hostname
$ sudonano/etc/minidlna.conf
$ sudonano/etc/upmpdcli.conf
$ sudonano/etc/shairport-sync.conf
$ sudonano/etc/raspotify/conf
# in Edition 2021 raspotify config (/etc/default/raspotify)
# and docker spot image must be changed as well, see the script 2021 below
# change hostname by script
# create the script in scripts directory
$ sudonano ~/scripts/musicloungerenamer2023.sh
# SCRIPT EDITION 2023
# insert these lines (copy then right-click on ssh session)
#!/bin/bash
# File: musicloungerenamer.sh
# Author: Linux Audio Foundation
# Requirements: MusicLounge Audiophile Distro
# Link: https://linuxaudiofoundation.org/musiclounge-multi-room-audio-configuration/
#
# get current arch
arch=$(dpkg --print-architecture)
# check if run as root
if [ "$(id -u)" -ne 0 ]; then
echo "This script must be run by root" >&2
exit 1
fi
CURR_HNAME=$(cat /etc/hostname)
NEW_HOSTNAME=$1
NEW_HOSTNAMELOW=${NEW_HOSTNAME,,}
echo "current hostname: ${CURR_HNAME}" >&2
echo "new hostname: ${NEW_HOSTNAME}" >&2
# empty new hostname
if [ -z "${NEW_HOSTNAME}" ]; then
echo "error: hostname (first parameter) is empty!" >&2
exit 1
fi
# no change
if [ "${CURR_HNAME}" == "${NEW_HOSTNAME}" ]; then
echo "Same host name exit with no change." >&2
exit 1
fi
# mini dlna cfg
sudo sed -i "s/$CURR_HNAME/$NEW_HOSTNAME/I" /etc/minidlna.conf
echo "minidlna service changed to: ${NEW_HOSTNAME}" >&2
# upmpdcli (upnp)cfg
sudo sed -i "s/$CURR_HNAME/$NEW_HOSTNAME/I" /etc/upmpdcli.conf
echo "upnp service changed to: ${NEW_HOSTNAME}" >&2
# air play cfg
# nothing to do as general section contains name = "%H" which is current hostname
sudo sed -i "s/$CURR_HNAME/$NEW_HOSTNAME/I" /etc/shairport-sync.conf
echo "AirPlay service changed to: ${NEW_HOSTNAME}" >&2
# spotify connect amd64 cfg
sudo sed -i "s/$CURR_HNAME/$NEW_HOSTNAME/I" /etc/raspotify/conf
echo "Spotify Connect (armhf/arm64) service changed to: ${NEW_HOSTNAME}" >&2
# hostname cfg
sudo sed -i "s/$CURR_HNAME/$NEW_HOSTNAMELOW/g" /etc/hostname
# hosts
sudo sed -i "s/$CURR_HNAME/$NEW_HOSTNAMELOW/g" /etc/hosts
echo "hostname and hosts changed to: ${NEW_HOSTNAMELOW}" >&2
# ask before rebooting
while true; do
read -p "Hostname and services have been changed for ${NEW_HOSTNAME}, reboot for the change to take effect (y / n)? " yx
case $yx in
[Yy]* ) sudo reboot; break;;
* ) exit;;
esac
done
# CTRL+O to save
# CTRL+X to exit
# change permision
# SCRIPT EDITION 2021
# change hostname by script
# create the script in scripts directory
$ sudonano ~/scripts/musicloungerenamer2021.sh
# insert these lines (copy then right-click on ssh session)
#!/bin/bash
# File: musicloungerenamer.sh
# Author: Linux Audio Foundation
# Requirements: MusicLounge Audiophile Distro
# Link: https://linuxaudiofoundation.org/musiclounge-multi-room-audio-configuration/
#
# get current arch
arch=$(dpkg --print-architecture)
# check if run as root
if [ "$(id -u)" -ne 0 ]; then
echo "This script must be run by root" >&2
exit 1
fi
CURR_HNAME=$(cat /etc/hostname)
NEW_HOSTNAME=$1
NEW_HOSTNAMELOW=${NEW_HOSTNAME,,}
echo "current hostname: ${CURR_HNAME}" >&2
echo "new hostname: ${NEW_HOSTNAME}" >&2
# empty new hostname
if [ -z "${NEW_HOSTNAME}" ]; then
echo "error: hostname (first parameter) is empty!" >&2
exit 1
fi
# no change
if [ "${CURR_HNAME}" == "${NEW_HOSTNAME}" ]; then
echo "Same host name exit with no change." >&2
exit 1
fi
# hostname cfg
sudo sed -i "s/$CURR_HNAME/$NEW_HOSTNAMELOW/g" /etc/hostname
# hosts
sudo sed -i "s/$CURR_HNAME/$NEW_HOSTNAMELOW/g" /etc/hosts
echo "hostname and hosts changed to: ${NEW_HOSTNAMELOW}" >&2
# mini dlna cfg
sudo sed -i "s/$CURR_HNAME/$NEW_HOSTNAME/I" /etc/minidlna.conf
echo "minidlna service changed to: ${NEW_HOSTNAME}" >&2
# upmpdcli (upnp)cfg
sudo sed -i "s/$CURR_HNAME/$NEW_HOSTNAME/I" /etc/upmpdcli.conf
echo "upnp service changed to: ${NEW_HOSTNAME}" >&2
# air play cfg
# nothing to do as general section contains name = "%H" which is current hostname
sudo sed -i "s/$CURR_HNAME/$NEW_HOSTNAME/I" /etc/shairport-sync.conf
echo "AirPlay service changed to: ${NEW_HOSTNAME}" >&2
# spotify connect armhf & arm64 cfg
if [ "amd64" != "$arch" ]; then
# armhf and arm64
sudo sed -i "s/$CURR_HNAME/$NEW_HOSTNAME/I" /etc/default/raspotify
echo "Spotify Connect (armhf/arm64) service changed to: ${NEW_HOSTNAME}" >&2
fi
# docker spot container on amd64 cfg
if [ "amd64" == "$arch" ]; then
# read -p "Press any key to stop Spotify Connect service"
sudo docker ps -q --filter "name=spot" | grep -q . && docker stop spot && docker rm -fv spot
# read -p "Press any key to change the new of Spotify Connect to ${NEW_HOSTNAME}"
export SPOTNAME=$(echo "NAME=${NEW_HOSTNAME}")
sudo docker run -d --restart unless-stopped \
--name "spot" \
--env $SPOTNAME \
--volume /tmp \
--group-add audio \
--device /dev/snd \
--net host \
--cap-drop ALL \
--read-only \
dubodubonduponey/librespot \
--backend alsa \
--device plughw:1,0 \
--disable-audio-cache \
--initial-volume=100
echo "Spotify Connect (Docker amd64) service changed to: ${NEW_HOSTNAME}" >&2
fi
# ask before rebooting
while true; do
read -p "Hostname and services have been changed for ${NEW_HOSTNAME}, reboot for the change to take effect (y / n)? " yx
case $yx in
[Yy]* ) sudo reboot; break;;
* ) exit;;
esac
done
# we suggest a name which identify the room easily like a Music or Audio prefix + the room name (e.g MusicBedroom, MusicLivingroom, MusicKitchen,…)
# run the script with the audio server name in parameter, example: