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


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

# all info below are applicable to Odroid and others boards
# 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 Linux Distro on Odroid C4,
# RaspiOS lite (Debian) buster for Raspberry PI 4,
# Debian Standard or Ubuntu server for amd64

# 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 armbian repository
# burn it on SDCARD (8GB is enough) with any tool like Win32DiskImager app on Windows
# connect your usb DAC to Odroid C4
# boot
# and start the ssh session
# default login/pass root/odroid or root/1234

# 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
  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

# 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

MusicLounge: Multi Room Audio Configuration

Multi Room Audio Configuration

# 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.

# create the script in scripts directory

  1. $ sudo nano ~/scripts/musicloungerenamer.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

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

# change permision

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

# 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:

  1. $ cd scripts/
  2. $ sudo ./musicloungerenamer.sh MusicKitchen

# type y to reboot the server
# that’s it!

MusicLounge: ROON Brigde / Server


# install official ROON brigde/server

  1. $ sudo apt-get update



# make sure curl is installed

  1. $ sudo apt install curl



# install dependency (ffmpeg lib)

  1. $ sudo apt-get install ffmpeg



# setup directory for installation

  1. $ sudo mkdir ~/Downloads/roon_server


  1. $ cd ~/Downloads/roon_server/



# Roon Server x86_64

  1. $ sudo curl -O http://download.roonlabs.com/builds/roonserver-installer-linuxx64.sh


  1. $ sudo chmod +x roonserver-installer-linuxx64.sh


  1. $ sudo ./roonserver-installer-linuxx64.sh



# Roon Bridge x86_64

  1. $ curl -O http://download.roonlabs.com/builds/roonbridge-installer-linuxx64.sh


  1. $ chmod +x roonbridge-installer-linuxx64.sh


  1. $ sudo ./roonbridge-installer-linuxx64.sh



# Roon Bridge armv7hf (32 bit)

  1. $ sudo curl -O http://download.roonlabs.com/builds/roonbridge-installer-linuxarmv7hf.sh


  1. $ sudo chmod +x roonbridge-installer-linuxarmv7hf.sh


  1. $ sudo ./roonbridge-installer-linuxarmv7hf.sh



# Roon Bridge armv8 (64 Bit)

  1. $ sudo curl -O http://download.roonlabs.com/builds/roonbridge-installer-linuxarmv8.sh


  1. $ sudo chmod +x roonbridge-installer-linuxarmv8.sh


  1. $ sudo ./roonbridge-installer-linuxarmv8.sh



# roon is now activated, get the status
# roon server

  1. $ sudo systemctl status roonserver

# roon bridge

  1. $ sudo systemctl status roonbridge

# Log File Location
# If you used the easy installer, log files can be found in `/var/roon/RoonServer/Logs`, `/var/roon/RAATServer/Logs`, and `/var/roon/RoonBridge/Logs`.

# activate or deactivate service
# roon server

  1. $ sudo systemctl enable roonserver
  1. $ sudo systemctl disable roonserver

# roon bridge

  1. $ sudo systemctl enable roonbridge
  1. $ sudo systemctl disable roonbridge

# start, stop, status or restart service
# roon server

  1. $ sudo systemctl start roonserver
  1. $ sudo systemctl stop roonserver
  1. $ sudo systemctl restart roonserver
  1. $ sudo systemctl status roonserver

# roon bridge

  1. $ sudo systemctl start roonbridge
  1. $ sudo systemctl stop roonbridge
  1. $ sudo systemctl restart roonbridge
  1. $ sudo systemctl status roonbridge

# Uninstalling
# You can reverse the steps of the easy installer by running it with ‘uninstall’ as a command line parameter. For example:
# Roon Server x86_64

  1. $ sudo ~/Downloads/roonserver/roonserver-installer-linuxx64.sh uninstall

# Roon Bridge x86_64

  1. $ sudo ~/Downloads/roonserver/roonbridge-installer-linuxx64.sh uninstall

# Roon Bridge armv7hf (32 bit)

  1. $ sudo ~/Downloads/roonserver/roonbridge-installer-linuxarmv7hf.sh uninstall

# Roon Bridge armv8 (64 Bit)

  1. $ sudo ~/Downloads/roonserver/roonbridge-installer-linuxarmv8.sh uninstall


MusicLounge: Squeezelite Player


# STEP21

# Add Squeezelite player (outdated emulation of squeezelitebox for using with LMS player)

# using your DAC to listen music from Logitech Media Server or any LMS media player

  1. $ sudo apt-get install squeezelite


# Edit conf. with 2 change only:

# type:

  1. $ sudo nano /etc/default/squeezelite


# SL_NAME="MusicLounge";

# SB_EXTRA_ARGS="-o plughw:1,0"

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

# Activate:

  1. $ sudo systemctl restart squeezelite


# That's it!

# enable/disable service:

  1. $ sudo systemctl enable squeezelite-service



# or

  1. $ sudo systemctl disable squeezelite-service


  1. $ sudo reboot


# More info:
https://github.com/ralph-irving/squeezelite

https://www.mysqueezebox.com/

MusicLounge: AirPlay Server


# STEP20

# Add Airplay server (16 bit 44.1 audio only)

# using your DAC to listen music from Apple devices

# We’re going to build the latest ShairportSync project which is the best implementation of airplay today

# building ShairportSync type these cmds:

# get dependencies:

  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


# get source:

  1. $ cd ~/Downloads/
  1. $ git clone https://github.com/mikebrady/shairport-sync.git


# build (with alsa):

  1. $ cd shairport-sync


  1. $ autoreconf -i -f


  1. $ ./configure --with-alsa --with-avahi --with-ssl=openssl --with-systemd --with-metadata


# Make and install:

# make

  1. $ sudo make install


# Activate:

  1. $ sudo systemctl enable shairport-sync


# Edit conf. with 2 change only:

# type:

  1. $ sudo nano /etc/shairport-sync.conf


# in general section:

name = "MusicLounge";

# in alsa section:

output_device = "plughw:1,0"

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

# Start:

  1. $ sudo service shairport-sync start

# That's it!


# on AMD64 (Debian 10 buster 64 Bit) if airplay service failed to start with error Failed to start Avahi mDNS/DNS-SD Stack
# then do the following

  1. $ sudo systemctl stop docker
  2. $ sudo systemctl stop docker.socket

# reinstall corrupted lib

  1. $ cd ~/Downloads

# download

  1. $ sudo wget http://ftp.de.debian.org/debian/pool/main/a/avahi/libavahi-core7_0.7-4+deb10u1_amd64.deb

# install:

  1. $ dpkg -i libavahi-core7_0.7-4+deb10u1_amd64.deb
  1. $ sudo apt reinstall avahi-daemon
  1. $ sudo reboot

# Mode info on shairport sync:
https://github.com/mikebrady/shairport-sync-for-openwrt

MusicLounge: Spotify Connect (On amd64 Distro Using Docker)


# STEP 19bis

** SKIP THIS INSTALLATION IF RASPOTIFY IS ALREADY INSTALLED **

# run Spotify Connect Client on Intel/AMD 64 Bit (amd64 platform)
# using Docker (librespot)
# More info available here:
https://github.com/dubo-dubon-duponey/docker-librespot

# ###################################################################################
# Beware Docker sub network can be in conflict with your LAN network configuration

# Install Docker

  1. $ sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release


  1. $ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg


  1. $ echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null


  1. $ sudo apt update


  1. $ sudo apt-get install docker-ce docker-ce-cli containerd.io

# check docker version installed

  1. $ apt-cache madison docker-ce


#check status (must be ACTIVE running )

  1. $ sudo systemctl status docker


# Install librespot container from
# https://github.com/dubo-dubon-duponey/docker-librespot

# download it

  1. $ sudo docker pull dubodubonduponey/librespot


# list all containers

  1. $ sudo docker images


# run librespot (as daemon) container name is spot with
# usb DAC device on card 1 (plughw:1,0 could be also hw:1,0 )
# Spotify Connect name is MusicLounge

$ sudo docker run -d --restart unless-stopped \
    --name "spot" \
    --env "NAME=MusicLounge" \
    --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

# Spotify Connect is now available!
# start a song, click the devices icon (bottom left) and choose MusicLounge Spotify Connect


# if MusicLounge is not visble on the Spotify connect devices list,
# stop the container and check the parameters before running again

# list of containers,

  1. $ sudo docker container ls

# if spot is in the list stop it

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

# then check your parameters and run it again (see the above command)


# librespot docker options

# -c, –cache CACHE Path to a directory where files will be cached.
# –disable-audio-cache
# Disable caching of the audio data.
# -n, –name NAME Device name
# –device-type DEVICE_TYPE
# Displayed device type
# -b, –bitrate BITRATE
# Bitrate (96, 160 or 320). Defaults to 160
# –onevent PROGRAM
# Run PROGRAM when playback is about to begin.
# –emit-sink-events
# Run program set by –onevent before sink is opened and after it is closed.
# -v, –verbose Enable verbose output
# -u, –username USERNAME
# Username to sign in with
# -p, –password PASSWORD
# Password
# –proxy PROXY HTTP proxy to use when connecting
# –ap-port AP_PORT
# Connect to AP with specified port. If no AP with that
# port are present fallback AP will be used. Available
# ports are usually 80, 443 and 4070
# –disable-discovery
# Disable discovery mode
# –backend BACKEND
# Audio backend to use. Use ‘?’ to list options
# –device DEVICE Audio device to use. Use ‘?’ to list options if using portaudio or alsa
# –mixer MIXER Mixer to use (alsa or softvol) -m,
# –mixer-name MIXER_NAME
# Alsa mixer name, e.g “PCM” or “Master”. Defaults to ‘PCM’
# –mixer-card MIXER_CARD
# Alsa mixer card, e.g “hw:0” or similar from `aplay -l`. Defaults to ‘default’
# –mixer-index MIXER_INDEX
# Alsa mixer index, Index of the cards mixer. Defaults to 0
# –mixer-linear-volume
# Disable alsa’s mapped volume scale (cubic). Default false
# –initial-volume VOLUME
# Initial volume in %, once connected (must be from 0 to 100)
# –zeroconf-port ZEROCONF_PORT
# The port the internal server advertised over zeroconf uses.
# –enable-volume-normalisation
# Play all tracks at the same volume
# –normalisation-pregain PREGAIN
# Pregain (dB) applied by volume normalisation
# –volume-ctrl VOLUME_CTRL
# Volume control type – [linear, log, fixed]. Default is logarithmic
# –autoplay autoplay similar songs when your music ends.
# –disable-gapless
# disable gapless playback.


# remove librespot container

# list of containers,

  1. $ sudo docker container ls

# if spot is in the list stop it

  1. $ sudo docker stop spot

# then list images

  1. $ sudo docker images

# get the IMAGE ID form the list and remove it

  1. $ sudo docker rmi IMAGE_ID

# remove docker
#list packages

  1. $ dpkg -l | grep -i docker



# remove

  1. $ sudo apt-get purge -y docker-ce docker-ce-cli docker-ce-rootless-extras docker-scan-plugin



# cleanup

  1. $ sudo apt-get autoremove -y --purge docker-ce docker-ce-cli docker-ce-rootless-extras docker-scan-plugin


MusicLounge: Spotify Connect (32Bit armhf Emulation)


# STEP19

# OPTIONAL: install Spotify Connect,

# using your DAC to listen music from Spotify

# More info on librespot
https://github.com/librespot-org/librespot

# More info on Spotify connect
https://support.spotify.com/us/article/spotify-connect/

# More info on Raspotify connect
https://dtcooper.github.io/raspotify/

Click titles below to expand.


amd64 platform like Intel NUC, Gigabyte BRIX, Mini-PC,... - Click To Read More

# #################################################################################
# DEBIAN/UBUNTU AMD64 PLATFORM
# #################################################################################

# SKIP THIS TUTO and go next tutorial to learn how to install Raspotify on amd64 using Docker


armhf platform like Raspberry PI 4 - Click To Read More

# #################################################################################
# ATTENTION Raspotify Pkg Is For 32Bit Linux Distro Only, armhf platform
# #################################################################################
#
# install librespot (Raspotify) on Raspberry PI 4 with RaspiOS armhf (32Bit) is easy:

# install curl

  1. $ sudo apt-get -y install curl apt-transport-https

# Add repo and its GPG key

  1. $ curl -sSL https://dtcooper.github.io/raspotify/key.asc | sudo apt-key add -v -
  1. $ echo 'deb https://dtcooper.github.io/raspotify raspotify main' | sudo tee /etc/apt/sources.list.d/raspotify.list

# Install pkg

  1. $ sudo apt-get update
  1. $ sudo apt-get -y install raspotify

# read below how to configure Raspotify


arm64 platform like Odroid C4 - Click To Read More
# #################################################################################
# on arm64 platform you can force installation of Raspotify 32 Bit pkg by using multi-arch
# applicable to Odroid C4 platform for example
# #################################################################################

# Force installation on Ubuntu arm64 (64Bit) using multi-arch

# add armhf platform

  1. $ sudo dpkg --add-architecture armhf

# check if added

  1. $ sudo dpkg --print-foreign-architectures
$ armhf

# update pkgs list

  1. $ sudo apt update

# Install curl and https apt transport

  1. $ sudo apt-get -y install curl apt-transport-https

# Add repo and its GPG key

  1. $ curl -sSL https://dtcooper.github.io/raspotify/key.asc | sudo apt-key add -v -
  1. $ echo 'deb https://dtcooper.github.io/raspotify raspotify main' | sudo tee /etc/apt/sources.list.d/raspotify.list

# edit sources list to target armhf platform

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

# change

deb https...

# by

deb [arch=armhf] https...

# Install pkgs list

  1. $ sudo apt-get update
  1. $ sudo apt-get -y install raspotify:armhf

# if your /var/log/syslog is fulfilled by deprecated …cp15_barrier
# add the following to any startup script like the good old /etc/rc.local
# if you are not too lazy then create a service it is better…

  1. $ sudo nano /etc/rc.local

# add this line to deactivate the warning

sudo bash -c "echo 2 > /proc/sys/abi/cp15_barrier"

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


# if for some reason this did not work on your Odroid C4 (arm64 platform) go next tutorial to install it with Docker
# to cleanup ALL previously installed armhf pkgs on arm64 platform

  1. $ sudo apt --purge remove "*:armhf"
  1. $ sudo apt autoremove
  1. $ sudo reboot

Raspotify configuration - Click To Read More

# #################################################################################
# Edit Raspotify configuration:
# #################################################################################

  1. $ sudo nano /etc/default/raspotify
DEVICE_NAME="MusicLounge"
BITRATE="160"
OPTIONS="--device plughw:1,0"

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

  1. $ sudo systemctl restart raspotify

# check the status

  1. $ sudo systemctl status raspotify

# Spotify Connect is now available!
# start a song, click the devices icon (bottom left) and choose MusicLounge.
# That’s it!


MusicLounge: UPNP Renderer (Local, Quobuz, Tidal And Others)


 


# STEP18

 

# OPTIONAL: Using your USB DAC as a UPnP Renderer (Control Point)

# UPnP renderer: music player like BubbleUpnp or UpnpPlay send the stream from local source
# or remote source like Quobuz or Tidal to your audiophile server using MusicLounge renderer

# install upmpdcli


# UBUNTU INSTALLATION

 

  1. $ sudo apt update
  1. $ sudo add-apt-repository ppa:jean-francois-dockes/upnpp1

# in case of error or the repository can’t be reached, install this pkg before

  1. $ sudo apt install software-properties-common

# install

  1. $ sudo apt install upmpdcli

# DEBIAN INSTALLATION
# add the repository for Debian buster list available here:
https://www.lesbonscomptes.com/upmpdcli/pages/downloads.html

  1. $ cd /etc/apt/sources.list.d/
  1. $ sudo wget https://www.lesbonscomptes.com/upmpdcli/pages/upmpdcli-buster.list

# update pkgs

  1. $ sudo apt update

# install repository key

  1. $ cd ~/Downloads
  1. $ gpg --no-default-keyring --keyring ./lesbonscomptes.gpg --keyserver pool.sks-keyservers.net --recv-key F8E3347256922A8AE767605B7808CE96D38B9201

# copy lesbonscomptes.gpg to /usr/share/keyrings/

  1. $ sudo cp lesbonscomptes.gpg /usr/share/keyrings/

# update pkgs

  1. $ sudo apt update

# install

  1. $ sudo apt install upmpdcli

# RASPBERRY PI INSTALLATION
# add the repository for Debian buster list available here:
https://www.lesbonscomptes.com/upmpdcli/pages/downloads.html

  1. $ cd /etc/apt/sources.list.d/
  1. $ sudo wget https://www.lesbonscomptes.com/upmpdcli/pages/upmpdcli-rbuster.list

# update pkgs

  1. $ sudo apt update

# install repository key

  1. $ cd ~/Downloads
  1. $ gpg --no-default-keyring --keyring ./lesbonscomptes.gpg --keyserver pool.sks-keyservers.net --recv-key F8E3347256922A8AE767605B7808CE96D38B9201

# copy lesbonscomptes.gpg to /usr/share/keyrings/

  1. $ sudo cp lesbonscomptes.gpg /usr/share/keyrings/

# update pkgs

  1. $ sudo apt update

# install

  1. $ sudo apt install upmpdcli

# Edit configuration the server:

 

  1. $ sudo nano /etc/upmpdcli.conf

# uncomment and modify friendly_name and checkcontentformat
# upnpAV is deactivated here (upnpav = 0)
# and should be 1 if you intend to play videos which is not the main purpose of an high end audiophile system
# OpenHome is also supported by default

friendly_name = MusicLounge
upnpav = 0
checkcontentformat = 0

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

# Start UPNP Renderer

  1. $ sudo systemctl enable upmpdcli

# status of the service:

  1. $ sudo systemctl status upmpdcli

# to stop the service (if needed) do the following:

  1. $ sudo systemctl stop upmpdcli

Congrats! You listen the music stored on your phone on your audiophile system using a UpNp Client like BubbleUpnp


More info on UPMPDCLI Project:
https://www.lesbonscomptes.com/upmpdcli/index.html

MusicLounge: DLNA Server


# STEP17

# OPTIONAL: Install a DLNA server (browse and stream the music very easily with your Upnp music player client )

# MiniDLNA Project:
https://sourceforge.net/projects/minidlna/

# Install DLNA server type:

  1. $ sudo apt install minidlna


# Edit configuration the server:

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

friendly_name=MusicLounge

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

  1. $ sudo systemctl restart minidlna


# That's it! you can now browse the music library with your Upnp music player like BubbleUpnp

# to check the status of the DLNA server open your net browser and type the ip address of the Raspberry followed by the dedicated port 8200:
# http://192.168.x.x:8200