moode-player / moode

moOde sources and configs
GNU General Public License v3.0
997 stars 166 forks source link

Gapless playback fails when resampling in mpd #596

Closed charleski closed 1 year ago

charleski commented 1 year ago

When upsampling audio, gapless playback fails as the following track skips the start of the track.

Max Kellerman (mpd dev) refuses to look at this since moode uses a patch to enable selective resampling.

resampleglitch2

mpd log: Jan 18 11:15 : client: [1] process command list returned 0 Jan 18 11:15 : client: [1] closed Jan 18 11:15 : client: [2] opened from 127.0.0.1:59622 Jan 18 11:15 : client: [2] process command "status" Jan 18 11:15 : client: [2] command returned 0 Jan 18 11:15 : client: [2] process command "currentsong" Jan 18 11:15 : client: [2] command returned 0 Jan 18 11:15 : client: [2] process command "lsinfo "USB/Music_Ext/Unfiled/Rinaldo test/15 Scena 5 - Furie terribili (Aria - Armida)-frgm.flac"" Jan 18 11:15 : client: [2] command returned 0 Jan 18 11:15 : client: [2] process command "close" Jan 18 11:15 : client: [2] command returned 4 Jan 18 11:15 : client: [2] closed Jan 18 11:15 : client: [3] opened from 127.0.0.1:59624 Jan 18 11:15 : client: [3] process command "status" Jan 18 11:15 : client: [3] command returned 0 Jan 18 11:15 : client: [3] process command "idle" Jan 18 11:15 : client: [3] command returned 1 Jan 18 11:15 : client: [4] opened from 127.0.0.1:59626 Jan 18 11:15 : client: [4] process command "currentsong" Jan 18 11:15 : client: [4] command returned 0 Jan 18 11:15 : client: [4] process command "close" Jan 18 11:15 : client: [4] command returned 4 Jan 18 11:15 : client: [4] closed Jan 18 11:15 : client: [5] opened from 127.0.0.1:59628 Jan 18 11:15 : client: [6] opened from 127.0.0.1:59632 Jan 18 11:15 : client: [6] process command "currentsong" Jan 18 11:15 : client: [6] command returned 0 Jan 18 11:15 : client: [6] process command "close" Jan 18 11:15 : client: [6] command returned 4 Jan 18 11:15 : client: [6] closed Jan 18 11:15 : client: [7] opened from 127.0.0.1:59634 Jan 18 11:15 : client: [7] process command "lsinfo" Jan 18 11:15 : client: [7] command returned 0 Jan 18 11:15 : client: [7] process command "close" Jan 18 11:15 : client: [7] command returned 4 Jan 18 11:15 : client: [7] closed Jan 18 11:15 : client: [8] opened from 127.0.0.1:59636 Jan 18 11:15 : client: [8] process command "status" Jan 18 11:15 : client: [8] command returned 0 Jan 18 11:15 : client: [8] process command "currentsong" Jan 18 11:15 : client: [8] command returned 0 Jan 18 11:15 : client: [5] process command "close" Jan 18 11:15 : client: [5] command returned 4 Jan 18 11:15 : client: [5] closed Jan 18 11:15 : client: [8] process command "lsinfo "USB/Music_Ext/Unfiled/Rinaldo test/15 Scena 5 - Furie terribili (Aria - Armida)-frgm.flac"" Jan 18 11:15 : client: [8] command returned 0 Jan 18 11:15 : client: [8] process command "close" Jan 18 11:15 : client: [8] command returned 4 Jan 18 11:15 : client: [8] closed Jan 18 11:15 : client: [9] opened from 127.0.0.1:59638 Jan 18 11:15 : client: [9] process command "status" Jan 18 11:15 : client: [9] command returned 0 Jan 18 11:15 : client: [9] process command "idle" Jan 18 11:15 : client: [9] command returned 1 Jan 18 11:15 : client: [10] opened from 127.0.0.1:59640 Jan 18 11:15 : client: [10] process command "playlistinfo" Jan 18 11:15 : client: [10] command returned 0 Jan 18 11:15 : client: [10] process command "close" Jan 18 11:15 : client: [10] command returned 4 Jan 18 11:15 : client: [10] closed Jan 18 11:15 : client: [11] opened from 127.0.0.1:59642 Jan 18 11:15 : client: [11] process command "currentsong" Jan 18 11:15 : client: [11] command returned 0 Jan 18 11:15 : client: [11] process command "close" Jan 18 11:15 : client: [11] command returned 4 Jan 18 11:15 : client: [11] closed Jan 18 11:15 : client: [12] opened from 127.0.0.1:59644 Jan 18 11:15 : client: [12] process command "currentsong" Jan 18 11:15 : client: [12] command returned 0 Jan 18 11:15 : client: [12] process command "close" Jan 18 11:15 : client: [12] command returned 4 Jan 18 11:15 : client: [12] closed Jan 18 11:15 : client: [13] opened from 127.0.0.1:59646 Jan 18 11:15 : client: [13] process command list Jan 18 11:15 : client: process command "clear" Jan 18 11:15 : client: command returned 0 Jan 18 11:15 : client: process command "add "USB/Music_Ext/Unfiled/Rinaldo test/15 Scena 5 - Furie terribili (Aria - Armida)-frgm.flac"" Jan 18 11:15 : client: command returned 0 Jan 18 11:15 : client: process command "add "USB/Music_Ext/Unfiled/Rinaldo test/16 Come a tempo giungesti, cara (Recitativo ed accopagnato - Argante, Armida)-frgm.flac"" Jan 18 11:15 : client: command returned 0 Jan 18 11:15 : client: process command "play" Jan 18 11:15 : playlist: play 0:"USB/Music_Ext/Unfiled/Rinaldo test/15 Scena 5 - Furie terribili (Aria - Armida)-frgm.flac" Jan 18 11:15 : client: command returned 0 Jan 18 11:15 : client: [13] process command list returned 0 Jan 18 11:15 : playlist: queue song 1:"USB/Music_Ext/Unfiled/Rinaldo test/16 Come a tempo giungesti, cara (Recitativo ed accopagnato - Argante, Armida)-frgm.flac" Jan 18 11:15 : client: [9] process command "status" Jan 18 11:15 : client: [9] command returned 0 Jan 18 11:15 : client: [3] process command "status" Jan 18 11:15 : client: [3] command returned 0 Jan 18 11:15 : client: [3] process command "currentsong" Jan 18 11:15 : client: [3] command returned 0 Jan 18 11:15 : client: [9] process command "currentsong" Jan 18 11:15 : client: [9] command returned 0 Jan 18 11:15 : decoder_thread: probing plugin flac Jan 18 11:15 : decoder: audio_format=44100:16:2, seekable=true Jan 18 11:15 : decoder: converting to 192000:24:2 Jan 18 11:15 : soxr: soxr engine 'cr64' Jan 18 11:15 : soxr: soxr precision=28, phase_response=50.00, passband_end=0.91, stopband_begin=1.00 Jan 18 11:15 : soxr: samplerate conversion ratio to 4.35 Jan 18 11:15 : client: [13] process command "close" Jan 18 11:15 : client: [13] command returned 4 Jan 18 11:15 : client: [13] closed Jan 18 11:15 : alsa_output: opened _audioout type=PLUG Jan 18 11:15 : alsa_output: buffer: size=48..131072 time=250..682667 Jan 18 11:15 : alsa_output: period: size=24..65536 time=125..341334 Jan 18 11:15 : alsa_output: default period_time = buffer_time/4 = 500000/4 = 125000 Jan 18 11:15 : alsa_output: format=S24_LE (Signed 24 bit Little Endian) Jan 18 11:15 : alsa_output: buffer_size=96000 period_size=24000 Jan 18 11:15 : output: opened "ALSA Default" (alsa) audio_format=192000:24:2 Jan 18 11:15 : replay_gain: replay gain mode has changed off->album Jan 18 11:15 : replay_gain: scale=1 Jan 18 11:15 : client: [3] process command "lsinfo "USB/Music_Ext/Unfiled/Rinaldo test/15 Scena 5 - Furie terribili (Aria - Armida)-frgm.flac"" Jan 18 11:15 : client: [3] command returned 0 Jan 18 11:15 : client: [3] process command "close" Jan 18 11:15 : client: [3] command returned 4 Jan 18 11:15 : client: [3] closed Jan 18 11:15 : client: [9] process command "lsinfo "USB/Music_Ext/Unfiled/Rinaldo test/15 Scena 5 - Furie terribili (Aria - Armida)-frgm.flac"" Jan 18 11:15 : client: [9] command returned 0 Jan 18 11:15 : client: [9] process command "close" Jan 18 11:15 : client: [9] command returned 4 Jan 18 11:15 : client: [9] closed Jan 18 11:15 : client: [14] opened from 127.0.0.1:59648 Jan 18 11:15 : client: [14] process command "status" Jan 18 11:15 : client: [14] command returned 0 Jan 18 11:15 : client: [14] process command "idle" Jan 18 11:15 : client: [14] command returned 1 Jan 18 11:15 : client: [15] opened from 127.0.0.1:59650 Jan 18 11:15 : client: [15] process command "playlistinfo" Jan 18 11:15 : client: [15] command returned 0 Jan 18 11:15 : client: [15] process command "close" Jan 18 11:15 : client: [15] command returned 4 Jan 18 11:15 : client: [15] closed Jan 18 11:15 : client: [16] opened from 127.0.0.1:59654 Jan 18 11:15 : client: [16] process command "currentsong" Jan 18 11:15 : client: [16] command returned 0 Jan 18 11:15 : client: [16] process command "close" Jan 18 11:15 : client: [16] command returned 4 Jan 18 11:15 : client: [16] closed Jan 18 11:15 : client: [17] opened from 127.0.0.1:59656 Jan 18 11:15 : client: [17] process command "currentsong" Jan 18 11:15 : client: [17] command returned 0 Jan 18 11:15 : client: [17] process command "close" Jan 18 11:15 : client: [17] command returned 4 Jan 18 11:15 : client: [17] closed Jan 18 11:15 : client: [18] opened from 127.0.0.1:59658 Jan 18 11:15 : client: [18] process command "currentsong" Jan 18 11:15 : client: [18] command returned 0 Jan 18 11:15 : client: [18] process command "close" Jan 18 11:15 : client: [18] command returned 4 Jan 18 11:15 : client: [18] closed Jan 18 11:15 : decoder_thread: probing plugin flac Jan 18 11:15 : decoder: audio_format=44100:16:2, seekable=true Jan 18 11:15 : decoder: converting to 192000:24:2 Jan 18 11:15 : soxr: soxr engine 'cr64' Jan 18 11:15 : soxr: soxr precision=28, phase_response=50.00, passband_end=0.91, stopband_begin=1.00 Jan 18 11:15 : soxr: samplerate conversion ratio to 4.35 Jan 18 11:15 : client: [19] opened from 127.0.0.1:59662 Jan 18 11:15 : client: [19] process command "currentsong" Jan 18 11:15 : client: [19] command returned 0 Jan 18 11:15 : client: [19] process command "close" Jan 18 11:15 : client: [19] command returned 4 Jan 18 11:15 : client: [19] closed Jan 18 11:15 : player: played "USB/Music_Ext/Unfiled/Rinaldo test/15 Scena 5 - Furie terribili (Aria - Armida)-frgm.flac" Jan 18 11:15 : client: [14] process command "status" Jan 18 11:15 : client: [14] command returned 0 Jan 18 11:15 : client: [14] process command "currentsong" Jan 18 11:15 : client: [14] command returned 0 Jan 18 11:15 : client: [14] process command "lsinfo "USB/Music_Ext/Unfiled/Rinaldo test/16 Come a tempo giungesti, cara (Recitativo ed accopagnato - Argante, Armida)-frgm.flac"" Jan 18 11:15 : client: [14] command returned 0 Jan 18 11:15 : client: [14] process command "close" Jan 18 11:15 : client: [14] command returned 4 Jan 18 11:15 : client: [14] closed Jan 18 11:15 : client: [20] opened from 127.0.0.1:59664 Jan 18 11:15 : client: [20] process command "currentsong" Jan 18 11:15 : client: [20] command returned 0 Jan 18 11:15 : client: [20] process command "close" Jan 18 11:15 : client: [20] command returned 4 Jan 18 11:15 : client: [20] closed Jan 18 11:15 : client: [21] opened from 127.0.0.1:59666 Jan 18 11:15 : client: [21] process command "status" Jan 18 11:15 : client: [21] command returned 0 Jan 18 11:15 : client: [21] process command "idle" Jan 18 11:15 : client: [21] command returned 1 Jan 18 11:15 : client: [22] opened from 127.0.0.1:59668 Jan 18 11:15 : client: [22] process command "playlistinfo" Jan 18 11:15 : client: [22] command returned 0 Jan 18 11:15 : client: [22] process command "close" Jan 18 11:15 : client: [22] command returned 4 Jan 18 11:15 : client: [22] closed Jan 18 11:15 : client: [23] opened from 127.0.0.1:59670 Jan 18 11:15 : client: [23] process command "currentsong" Jan 18 11:15 : client: [23] command returned 0 Jan 18 11:15 : client: [23] process command "close" Jan 18 11:15 : client: [23] command returned 4 Jan 18 11:15 : client: [23] closed Jan 18 11:16 : client: [24] opened from 127.0.0.1:59672 Jan 18 11:16 : client: [24] process command "currentsong" Jan 18 11:16 : client: [24] command returned 0 Jan 18 11:16 : client: [24] process command "close" Jan 18 11:16 : client: [24] command returned 4 Jan 18 11:16 : client: [24] closed Jan 18 11:16 : client: [25] opened from 127.0.0.1:59674 Jan 18 11:16 : client: [25] process command "currentsong" Jan 18 11:16 : client: [25] command returned 0 Jan 18 11:16 : client: [25] process command "close" Jan 18 11:16 : client: [25] command returned 4 Jan 18 11:16 : client: [25] closed Jan 18 11:16 : client: [26] opened from 127.0.0.1:59676 Jan 18 11:16 : client: [26] process command "currentsong" Jan 18 11:16 : client: [26] command returned 0 Jan 18 11:16 : client: [26] process command "close" Jan 18 11:16 : client: [26] command returned 4 Jan 18 11:16 : client: [26] closed Jan 18 11:16 : client: [27] opened from 127.0.0.1:59678 Jan 18 11:16 : client: [27] process command "currentsong" Jan 18 11:16 : client: [27] command returned 0 Jan 18 11:16 : client: [27] process command "close" Jan 18 11:16 : client: [27] command returned 4 Jan 18 11:16 : client: [27] closed Jan 18 11:16 : player: played "USB/Music_Ext/Unfiled/Rinaldo test/16 Come a tempo giungesti, cara (Recitativo ed accopagnato - Argante, Armida)-frgm.flac" Jan 18 11:16 : playlist: stop

mpd conf: #########################################

This file is automatically generated

by the MPD configuration page.

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

music_directory "/var/lib/mpd/music" playlist_directory "/var/lib/mpd/playlists" db_file "/var/lib/mpd/database" log_file "/var/log/mpd/log" pid_file "/var/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" auto_update "no" follow_outside_symlinks "yes" follow_inside_symlinks "yes" zeroconf_enabled "no" zeroconf_name "Moode MPD" filesystem_charset "UTF-8" metadata_to_use "+comment" audio_output_format "192000:24:2" replaygain "album" replaygain_preamp "0" volume_normalization "no" audio_buffer_size "8192" max_output_buffer_size "262144" max_playlist_length "16384" max_connections "128"

decoder { plugin "ffmpeg" enabled "yes" }

input { plugin "curl" }

resampler { plugin "soxr" quality "very high" threads "0" }

audio_output { type "alsa" name "ALSA Default" device "_audioout" mixer_type "none" dop "no" stop_dsd_silence "no" thesycon_dsd_workaround "no" }

audio_output { type "alsa" name "ALSA Bluetooth" device "_audioout" mixer_type "software" }

audio_output { type "httpd"

name "HTTP Server" port "8000" encoder "flac" compression "0" tags "yes" always_on "yes" }

pi@moode:~ $ mpd --version Music Player Daemon 0.23.11 (r822prod-18-gb35b25b) Copyright 2003-2007 Warren Dukes warren.dukes@gmail.com Copyright 2008-2021 Max Kellermann max.kellermann@gmail.com This is free software; see the source for copying conditions. There is NO warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Database plugins: simple proxy

Storage plugins: local

Decoders plugins: [mad] mp3 mp2 [mpg123] mp3 [vorbis] ogg oga [oggflac] ogg oga [flac] flac [opus] opus ogg oga [dsdiff] dff [dsf] dsf [hybrid_dsd] m4a [faad] aac [wavpack] wv [adplug] amd d00 hsc laa rad raw sa2 [ffmpeg] 16sv 3g2 3gp 4xm 8svx aa3 aac ac3 adx afc aif aifc aiff al alaw amr anim apc ape asf atrac au aud avi avm2 avs bap bfi c93 cak cin cmv cpk daud dct divx dts dv dvd dxa eac3 film flac flc fli fll flx flv g726 gsm gxf iss m1v m2v m2t m2ts m4a m4b m4v mad mj2 mjpeg mjpg mka mkv mlp mm mmf mov mp+ mp1 mp2 mp3 mp4 mpc mpeg mpg mpga mpp mpu mve mvi mxf nc nsv nut nuv oga ogm ogv ogx oma ogg omg opus psp pva qcp qt r3d ra ram rl2 rm rmvb roq rpl rvc shn smk snd sol son spx str swf tak tgi tgq tgv thp ts tsp tta xa xvid uv uv2 vb vid vob voc vp6 vmd wav webm wma wmv wsaud wsvga wv wve rtp:// rtsp:// rtsps:// [pcm]

Filters: soxr

Tag plugins: id3tag

Output plugins: shout null fifo pipe alsa httpd recorder

Encoder plugins: null vorbis opus lame wave flac

Archive plugins: [bz2] bz2 [zzip] zip [iso] iso

Input plugins: file io_uring archive alsa curl ffmpeg cdio_paranoia

Playlist plugins: extm3u m3u pls xspf asx rss flac cue embcue

Protocols: file:// alsa:// cdda:// ftp:// ftps:// gopher:// hls+http:// hls+https:// http:// https:// mmsh:// mmst:// rtmp:// rtmps:// rtmpt:// rtmpts:// rtp:// rtsp:// rtsps:// scp:// sftp:// smb:// srtp://

Other features: avahi dbus epoll icu inotify systemd tcp un

moodeaudio commented 1 year ago

Our "Selective Resampling" patch doesn't alter how the SoX resampler itself works it only serves to decide whether to engage the resampler before track play based on the track's sample rate.

It's possible of course that this logic somehow causes the artifact you are seeing in the waveform at the transition between gapless tracks.

  1. Does the issue occur only when Selective Resampling is enabled?
  2. What software is being used to render the waveforms
charleski commented 1 year ago

Yes, I can't see how your patch would cause this behaviour, but he's using it as a reason to label moode as 'unsupported'. https://github.com/MusicPlayerDaemon/MPD/issues/1692

This example was captured with the resampler set to 192kHz without Selective Reasmpling. The waveforms were captured using arecord with the loopback turned on. arecord captured the resampled waveform at 192kHz and the unresampled wave at 44.1kHz (original is 44.1kHz) The image shown is from Audition. I used Audition to resample the 44.1kHz wave to 192kHz and then inserted both into a multitrack session and aligned them manually.

I should add that the glitch is clearly audible on playback, and turning resampling off leads to perfect gapless playback.

moodeaudio commented 1 year ago

MPD maintainer is justified in rejecting support for patched versions. This is very common and we generally do the same in our project for modified versions of moOde.

Your results (summarized below) would suggest an issue possibly with the SoX resampler itself.

  1. No glitch occurs with resampling off
  2. Glitch occurs with resampling on but Selective Resampling off

Couple of things to try:

  1. Resample to a multiple of the base frequency for example 176.4 (note the dropdown shows 176.41 but its just a display error)
  2. Build a generic test consisting of plain RaspiOS Lite and MPD 0.23.11 to factor out MPD patch or anything else specific to moOde then test with resampling on/off.

If the issue occurs using the generic test it could be submitted to MPD project but if the issue is in SoX itself then it may also need to be submitted to the SoX project.

If no glitch occurs using the generic test then it would suggest a possible issue in moOde build and we can investigate.

bitkeeper commented 1 year ago

@charleski I also think also that the patch has nothing to do with it, but to take it out of the picture you can upgrade/downgrade to the latest version from debian.

moodeaudio commented 1 year ago

Below is a recipe that can be used to create a generic MPD test platform from stock RaspiOS and MPD sources. It can be used to try and reproduce the issue. The results can then be submitted to MPD maintainer.

I'll reopen this issue if there is some activity toward the generic test.

#
# Build MPD from sources
#

# 
# Use Raspberrry Pi Imager
# - Select "Raspberry Pi OS Lite (64-bit)"
# - Click the gear icon: Enable SSH, set Username pi and password then SAVE
# - Write the image
#

#
# After first boot
# - ssh pi@raspberrypi
# - sudo apt update
# - sudo apt -y upgrade
# - sudo reboot
#

#
# Install core packages and build tooling
#

sudo apt -y install ffmpeg mpc
sudo apt -y install cmake git clang-11 meson

#
# Create MPD runtime environment
#

sudo useradd mpd
sudo mkdir /var/lib/mpd
sudo mkdir /var/lib/mpd/music
sudo mkdir /var/lib/mpd/playlists
sudo touch /var/lib/mpd/state
sudo chown -R mpd:audio /var/lib/mpd
sudo mkdir /var/log/mpd
sudo touch /var/log/mpd/log
sudo chmod 644 /var/log/mpd/log
sudo chown -R mpd:audio /var/log/mpd
sudo touch /etc/mpd.conf
sudo chown mpd:audio /etc/mpd.conf
sudo chmod 0666 /etc/mpd.conf

#
# Install dev libs
#

sudo apt -y install \
libyajl-dev \
libasound2-dev \
libavahi-client-dev \
libboost-all-dev \
libavcodec-dev \
libavformat-dev \
libbz2-dev \
libcdio-paranoia-dev \
libcurl4-gnutls-dev \
libfaad-dev \
libflac-dev \
libglib2.0-dev \
libicu-dev \
libid3tag0-dev \
libiso9660-dev \
libmad0-dev \
libmpdclient-dev \
libmpg123-dev \
libmp3lame-dev \
libshout3-dev \
libsoxr-dev \
libsystemd-dev \
libvorbis-dev \
libwavpack-dev \
libwrap0-dev \
libzzip-dev \
libpcre++-dev

#
# Download MPD sources
#

BRANCH=0.23
VERSION=.12
sudo wget http://www.musicpd.org/download/mpd/$BRANCH/mpd-$BRANCH$VERSION.tar.xz
sudo tar xf mpd-$BRANCH$VERSION.tar.xz
cd mpd-$BRANCH$VERSION
sudo meson . output/release --buildtype=release -Db_ndebug=true

#
# Configure compile options
#

sudo meson configure \
-Dalsa=enabled \
-Dbzip2=enabled \
-Dcurl=enabled \
-Ddatabase=true \
-Ddsd=true \
-Dffmpeg=enabled \
-Dfaad=enabled \
-Dflac=enabled \
-Dhttpd=true \
-Did3tag=enabled \
-Dlame=enabled \
-Dlibmpdclient=enabled \
-Dmad=enabled \
-Dmpg123=enabled \
-Dpipe=true \
-Drecorder=true \
-Dshout=enabled \
-Dsoxr=enabled \
-Dvorbis=enabled \
-Dwave_encoder=true \
-Dwavpack=enabled \
-Dzeroconf=avahi \
-Dpcre=enabled \
-Dzzip=enabled \
-Dao=disabled \
-Daudiofile=disabled \
-Ddbus=disabled \
-Dexpat=disabled \
-Dfluidsynth=disabled \
-Dgme=disabled \
-Dipv6=disabled \
-Djack=disabled \
-Dlibsamplerate=disabled \
-Dnfs=disabled \
-Doss=disabled \
-Dpulse=disabled \
-Dsidplay=disabled \
-Dsmbclient=disabled \
-Dsndfile=disabled \
-Dsqlite=disabled \
-Dudisks=disabled \
-Dupnp=disabled \
-Dwildmidi=disabled \
-Dsoundcloud=disabled \
-Dtidal=disabled \
-Dqobuz=disabled
output/release

#
# Compile and install MPD
#

sudo ninja -C output/release
sudo ninja -C output/release install

# 
# Add location of mpd.conf to ExecStart
#
sudo nano /usr/local/lib/systemd/system/mpd.service
ExecStart=/usr/local/bin/mpd --systemd /etc/mpd.conf

#
# Paste below into /etc/mpd.conf
# Change plughw:0,0 and hw:0 depending on which card has Headphones assigned.
# For example if its assigned to card 1 then plughw:1,0 and hw:1
#
sudo nano /etc/mpd.conf

music_directory "/var/lib/mpd/music"
playlist_directory "/var/lib/mpd/playlists"
db_file "/var/lib/mpd/database"
log_file "/var/log/mpd/log"
pid_file "/var/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"
auto_update "no"
follow_outside_symlinks "yes"
follow_inside_symlinks "yes"
zeroconf_enabled "no"
zeroconf_name "Moode MPD"
filesystem_charset "UTF-8"
metadata_to_use "+comment"
replaygain "off"
replaygain_preamp "0"
volume_normalization "no"
audio_buffer_size "4096"
max_output_buffer_size "131072"
max_playlist_length "16384"
max_connections "128"

decoder {
plugin "ffmpeg"
enabled "yes"
}

input {
plugin "curl"
}

resampler {
plugin "soxr"
quality "high"
threads "1"
}

audio_output {
type "alsa"
name "ALSA Default"
device "plughw:0,0"
mixer_type "hardware"
mixer_control "Headphone"
mixer_device "hw:0"
mixer_index "0"
dop "no"
stop_dsd_silence "no"
thesycon_dsd_workaround "no"
}

#
# Verify working installation
#

sudo systemctl start mpd
mpc
mpc volume 10

#
# End
#