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

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

MusicLounge: Add LIRC Service (Odroid IR Remote Ctrl)


# ###############################################################################
# if Triggerhappy RC service has been previously installed
it may not be necessary to install Lirc

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

# STEP 16bis

# OPTIONAL: Remote Control Management with LIRC

# the previous tutorial on remote management by the very easy to use TriggerHappy did not make you happy? so you want a deep control of your RC? read the following…

# Using the integrated IR sensor of the Odroid board to drive your music library with a remote control is possible
# We are going to install a remote control management using LIRC (Linux Infrared Remote Control )

# for the example we use a very common Remote Control using the standard MCE (Media Center Remote Control) format
# reference Remote Control is XPC-RC01

# do not plug the USB IR sensor included with the remote control, in this example we do not need it as we use the IR sensor integrated on Odroid board
# more info on LIRC is available here: https://lirc.org/

# a snapshot of lirc remotes is available for download here:
# download it, extract it and browse remote images to find the closest one
https://sourceforge.net/p/lirc-remotes/code/ci/master/tree/remotes/

# install LIRC

# Armbian for Odroid boards includes a wizard for LIRC installation,
# launch armbian-config and select Network > Install IR

  1. $ sudo armbian-config

# to install it manually

  1. $ sudo apt-get install lirc

# modify the driver

  1. $ sudo nano /etc/lirc/lirc_options.conf
[lircd]
nodaemon        = False
driver          = default
device          = /dev/lirc0
output          = /var/run/lirc/lircd
pidfile         = /var/run/lirc/lircd.pid
plugindir       = /usr/lib/aarch64-linux-gnu/lirc/plugins
permission      = 666
allow-simulate  = No
repeat-max      = 600

[lircmd]
uinput          = False
nodaemon        = False

[modinit]
code = /sbin/modprobe meson-ir

[lircd-uinput]
# add-release-events = True
# release-timeout    = 50
# release-suffix     = _EVUP

# modify the default remote control configuration file
# this one is based on Remote Control ShuttleX conf (PN31) available here
# http://lirc.sourceforge.net/remotes/shuttle/PN31
# Remote Control DB is available here:
# https://sourceforge.net/p/lirc-remotes/code/ci/master/tree/remotes/

# create the remote config file

  1. $ sudo nano /etc/lirc/lircd.conf.d/myremote.lircd.conf
# copy the configuration
#
# this config file was automatically generated
# using WinLIRC 0.6.5 (LIRC 0.6.1pre3) on Mon Aug 25 22:24:07 2003
#
# contributed by lirc @ trollmaster.net
#
# brand:        made in china
# model:        XPC-RC01 based on PN31 from ShuttleX
# supported devices: 
#

begin remote

  name  CNRemote
  bits            9
  flags SPACE_ENC
  eps            40
  aeps          100

  header       3021  1469
  one           310   266
  zero          310   780
  ptrail        310
  post_data_bits  8
  post_data      0xFC
  gap          12038
  toggle_bit      0


      begin codes
          KEY_POWER                0x000000000000017B
          KEY_TV                   0x00000000000001BB
          print                    0x000000000000013B
          KEY_EXIT                 0x00000000000001DB
          KEY_AUDIO                0x000000000000015B
          KEY_IMAGES               0x000000000000019B
          KEY_VIDEO                0x000000000000011B
          KEY_MENU                 0x00000000000001EB
          KEY_BACK                 0x000000000000014B
          KEY_R                    0x000000000000018B
          KEY_OK                   0x0000000000000177
          KEY_PREVIOUS             0x000000000000016B
          KEY_PLAYPAUSE            0x00000000000001AB
          KEY_NEXT                 0x000000000000012B
          KEY_REWIND               0x0000000000000167
          KEY_STOP                 0x00000000000001B7
          KEY_FASTFORWARD          0x000000000000016F
          KEY_VOLUMEUP             0x00000000000001A7
          KEY_VOLUMEDOWN           0x0000000000000127
          KEY_INFO                 0x0000000000000137
          KEY_CHANNELUP            0x00000000000001AF
          KEY_CHANNELDOWN          0x000000000000012F
          KEY_MUTE                 0x00000000000001C7
          KEY_RECORD               0x00000000000001D7
          KEY_BACKSPACE            0x00000000000001CF
          KEY_1                    0x0000000000000147
          KEY_2                    0x0000000000000157
          KEY_3                    0x000000000000014F
          KEY_4                    0x0000000000000187
          KEY_5                    0x0000000000000197
          KEY_6                    0x000000000000018F
          KEY_7                    0x0000000000000107
          KEY_8                    0x0000000000000117
          KEY_9                    0x000000000000010F
          KEY_DOT                  0x00000000000001FB
          KEY_0                    0x00000000000001E7
          KEY_L                    0x00000000000001F7
          KEY_UP                   0x00000000000001B3
          KEY_DOWN                 0x000000000000011F
          KEY_LEFT                 0x00000000000001EF
          KEY_RIGHT                0x00000000000001BF
      end codes

end remote

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

# change the default remote control buttons configuration to drive MPD with irexec a special daemon included with LIRC

  1. $ sudo nano /etc/lirc/irexec.lircrc
begin
 prog = irexec
 button = KEY_PLAY
 config = mpc play >/dev/null
 flags = quit
end

begin
 prog = irexec
 button = KEY_STOP
 config = mpc stop >/dev/null
 flags = quit
end

begin
 prog = irexec
 button = KEY_PAUSE
 config = mpc pause >/dev/null
 flags = quit
end

begin
 prog = irexec
 button = KEY_PLAYPAUSE
 config = mpc toggle >/dev/null
 flags = quit
end

begin
 prog = irexec
 button = KEY_NEXT
 config = mpc next >/dev/null
 flags = quit
end

begin
 prog = irexec
 button = KEY_PREVIOUS
 config = mpc prev >/dev/null
 flags = quit
end

begin
 prog = irexec
 button = KEY_FASTFORWARD
 config = mpc seek +10 >/dev/null
 flags = quit
end

begin
 prog = irexec
 button = KEY_FORWARD
 config = mpc seek +10 >/dev/null
 flags = quit
end


begin
 prog = irexec
 button = KEY_REWIND
 config = mpc seek -10 >/dev/null
 flags = quit
end

begin
 prog = irexec
 button = KEY_3
 config = /home/pi/scripts/./playlist3.sh >/dev/null
 flags = quit
end

begin
 prog = irexec
 button = KEY_1
 config = /home/pi/scripts/./playlist1.sh >/dev/null
 flags = quit
end

begin
 prog = irexec
 button = KEY_2
 config = /home/pi/scripts/./playlist2.sh >/dev/null
 flags = quit
end

begin
 prog = irexec
 button = KEY_6
 config = /home/pi/scripts/./lowbass.sh >/dev/null
 flags = quit
end

begin
 prog = irexec
 button = KEY_9
 config = /home/pi/scripts/./jbleq.sh >/dev/null
 flags = quit
end

begin
 prog = irexec
 button = KEY_0
 config = mpc enable only 1 && mpc play >/dev/null
 flags = quit
end

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

# create a symbolic link to match any version of irexec

  1. $ sudo ln -s /etc/lirc/irexec.lircrc /etc/lirc/lircrc

# we can already enable LIRC service and run irexec manually to catch remote control button and drive MPD
# but it’s better to modify the irexec service to start it at boot

  1. $ sudo nano /lib/systemd/system/irexec.service
[Unit]
Documentation=man:irexec(1)
Documentation=http://lirc.org/html/configure.html
Documentation=http://lirc.org/html/configure.html#lircrc_format
Description=Handle events from IR remotes decoded by lircd(8)
After=network.target
Wants=lircd.service

[Service]
Type=simple
ExecStart=/usr/bin/irexec /etc/lirc/irexec.lircrc
Restart=on-failure
SuccessExitStatus=3 4
RestartForceExitStatus=3 4

[Install]
WantedBy=multi-user.target

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

# activate LIRC and IREXEC service

  1. $ sudo systemctl daemon-reload
  1. $ sudo systemctl start lircd
  2. $ sudo systemctl enable lircd
  1. $ sudo systemctl enable irexec
  2. $ sudo systemctl status irexec

# be sure to stop lircd uinput service to not inject key events to kernel

  1. $ sudo systemctl stop lircd-uinput.service
  2. $ sudo systemctl disable lircd-uinput.service
  3.  
  4. $ sudo systemctl status lircd-uinput.service

# reboot and chek the status

  1. $ sudo reboot
  2.  
  3. $ sudo systemctl status lircd

# both services are now activated, enabled and running at startup

# if your remote control do not send the correct key use the dump function to
# identify the correct key and change your cmds in /etc/lirc/irexec.lircrc (see above)

# To dump all events received through your remote control (useful to get the corresponding keys):

  1. $ irw

# CTRL+C to exit

# Run your MPD Client (MALP Android for example) play an album
# use your remote control to stop, play, go next, prev,…

# Congrats! Your MCE Remote controls the Music Player Daemon!

Click the button NEXT below to continue…