TROUBLESHOOTING: GENERAL


# TS6

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

  1. $ sudo systemctl status mpd

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

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

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

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

# check if nano cmd is available using:

  1. sudo /bin/nano .bashrc

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

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

# UPGRADE or DOWNGRADE YOUR KERNEL


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


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

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

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

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

MusicLounge: myMPD WEB Client


# STEP15

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

# install dependencies, compile and install myMPD

  1. cd ~/Downloads/

# install git if the command is not found

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

# install

  1. $ sudo ./build.sh install

# configure the port

  1. $ sudo nano /etc/mympd.conf

# change httpport = 80 to

httpport = 8080

# deactivate SSL

ssl = false

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

smartpls = false
home = false

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

# activate myMPD service

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

# reboot

  1. $ sudo reboot

# check the status

  1. $ sudo systemctl status mympd

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

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

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

# Enjoy your music library from any remote device

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

MusicLounge: Update MPD Database

 


# STEP14

 

# Congrats! MPD is installed and running!

# First Steps With Music Player Daemon

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

  1. $ mpc update


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

  1. $ mpc status


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

# loop with

  1. $ mpc status


# until the DB is updated

 


# STEP15

 

  1. $ mpc status


# play songs to check if everything is OKAY! đŸ˜‰

# use your MPD music player like MALP for Android
# select the correct ALSA audio output
# and to browse your library and enjoy your music!

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

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

Browse your music library with MALP for Android

MusicLounge: Activate MPD


# STEP11

# activate service

  1. $ sudo systemctl enable mpd


# restart MPD

  1. $ sudo systemctl start mpd


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

  1. $ sudo systemctl status mpd


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


# STEP12

# create playlists directory if not exists

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

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

# if the directory does not exist, create it

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


# change user:group if not mpd:audio

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



# set permission if not already 755

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


Click the button NEXT below to continue...

MusicLounge: Configure MPD


# STEP10

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

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

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

  1. $ aplay -l

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

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

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

# the USB DAC should be indexed 1 or 2

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


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

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

# erase the current config and replace with the settings below

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

# replace with the settings below

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

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

music_directory "/mnt/media"
playlist_directory "/var/lib/mpd/playlists"
db_file "/var/lib/mpd/tag_cache"
log_file "/var/log/mpd/mpd.log"
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"
}

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
}



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

# disable MPD user service as you run it on headless server:

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

# MPD is now configured.
#

 


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

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

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

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

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

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

# nothing for the topping D90

# now for the S9 Pro

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

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

  1. $ sudo nano /etc/mpd.conf

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

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

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

# that’s it!

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


 


 
Click the button NEXT below to continue…

MusicLounge: Music Player Daemon (MPD) Server



# STEP9

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

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

  1. $ ls /usr/local/etc

# result should be empty or not found then type

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

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

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

  1. $ ls /usr/local/etc

# optional pkg update

  1. $ sudo apt update

# install MPD

  1. $ sudo apt install mpd mpc -y

# Check mpd version

  1. $ mpd -V

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

# our recommendation is to start with the super stable 0.21.22 and later give the latest version of MPD a try (0.22.8 seems to be a good candidate as well).

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

Click NEXT button below to skip the compilation of MPD …


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

# check your gcc version:

  1. $ gcc --version
# if command not found install build-essential package
  1. $ sudo apt -y install build-essential

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

  1. $ sudo apt install gcc-8-base

# FOR RASPBERRY PI 4 OWNERS:
# on compilation error increase swap file size,
# change default 100 to 1024

  1. $ sudo nano /etc/dphys-swapfile

CONF_SWAPSIZE=1024

# reboot if you change the swap size

  1. $ sudo reboot

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

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

  1. cd ~/Downloads

# hyper stable MPD release

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

# latest at this date:

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

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

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

# enter directory:

  1. $ cd mpd-0.21.22

# install dependencies:

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

  1. $ sudo apt-get install ninja-build
# the command below must includes a lot of dev libraries # be careful to double check it before validation with enter key #
$ sudo apt install meson g++ \
libpcre3-dev \
libmad0-dev libmpg123-dev libid3tag0-dev \
libflac-dev libvorbis-dev libopus-dev libogg-dev \
libadplug-dev libaudiofile-dev libsndfile1-dev libfaad-dev \
libfluidsynth-dev libgme-dev libmikmod-dev libmodplug-dev \
libmpcdec-dev libwavpack-dev libwildmidi-dev \
libsidplay2-dev libsidutils-dev libresid-builder-dev \
libavcodec-dev libavformat-dev \
libmp3lame-dev libtwolame-dev libshine-dev \
libsamplerate0-dev libsoxr-dev \
libbz2-dev libcdio-paranoia-dev libiso9660-dev libmms-dev \
libzzip-dev \
libcurl4-gnutls-dev libyajl-dev libexpat-dev \
libasound2-dev libao-dev libjack-jackd2-dev libopenal-dev \
libpulse-dev libshout3-dev \
libsndio-dev \
libmpdclient-dev \
libnfs-dev \
libupnp-dev \
libavahi-client-dev \
libsqlite3-dev \
libsystemd-dev \
libgtest-dev \
libboost-dev \
libicu-dev \
libchromaprint-dev \
libgcrypt20-dev 

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

  1. $ meson -v

# configure:

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

# check configuration:

  1. $ sudo meson configure output/release

# compile (could take a while… ):

  1. $ sudo ninja -C output/release

# install:

# stop mpd in case it’s running

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

# go to home directory

  1. $ cd ~/

# Congrats! MPD is compiled and installed

Click the button NEXT below to continue…