Music Player Daemon

Music Player Daemon (MPD) is a flexible, powerful, server-side application for playing music. Through plugins and libraries it can play a variety of sound files while being controlled by its network protocol.


Issues encountered

No song displayed ✅

Success

I needed to manually add the songs from ${HOME}/Music folder:

$ cd "${HOME}/Music"
$ for f in *.mp3; do; mpc add "${f}"; done

When I’m trying to play a song, nothing comes out.

$ mpc
volume:100%   repeat: off   random: off   single: off   consume: off

and mpd:

$ mpd --no-daemon --stderr --verbose
...
client: [0] opened from 127.0.0.1:60496
client: [0] process command list
client: process command "status"
client: command returned 0
client: process command "currentsong"
client: command returned 0
client: [0] process command list returned 0
client: [0] closed

When trying to search for any song, nothing came out:

$ mpc ls
foobar.mp3
L.Louis
$ mpc search any Louis | wc -l
0

Looking at this stackoverflow, I tried:

$ mpc add ~/Music/foobar.mp3
error adding /home/l-lin/Music/foobar.mp3: Access denied

Someone has the same error as me: arch linux - mpc: access denied when adding mp3 file in a folder under music_directory - Unix & Linux Stack Exchange. Unfortunately, no answer 😔

Looking at this answer, I must not use absolute path.

So by going to the ~/Music folder then adding the songs:

$ cd ~/Music
$ mpc add foobar.mp3
 
$ # Music is live!!!
$ mpc play
foobar.mp3
[playing] #1/2   0:00/4:13 (0%)
volume:100%   repeat: off   random: off   single: off   consume: off
 
$ # Adding all musics
$ for f in *.mp3; do mpc add "$f"; done

The documentation is really not clear that we need to manually add the songs…

RTIOThread could not get realtime scheduling ❌

Fail

Could not get rid of this error. I did not investigate longer as it seems to be useful when the computer is under load so that the audio can be well sync, which I do not really need.

When trying to run mpd, I got the following error:

$ mpd --no-daemon --stderr --verbose
config_file: loading file /home/l-lin/.config/mpd/mpd.conf
libsamplerate: libsamplerate converter 'Fastest Sinc Interpolator'
vorbis: Xiph.Org libVorbis 1.3.7
opus: libopus 1.5.2
hybrid_dsd: The Hybrid DSD decoder is disabled because it was not explicitly enabled
simple_db: reading DB
input: Input plugin 'qobuz' is not configured: No Qobuz app_id configured
curl: version 8.8.0
curl: with OpenSSL/3.0.13
event: RTIOThread could not get realtime scheduling, continuing anyway: sched_setscheduler failed: Operation not permitted
inotify: initializing inotify
inotify: watching music directory

According to the mpd author, it’s documented here: https://mpd.readthedocs.io/en/stable/user.html#real-time-scheduling.

Doing with ulimit does not work:

$ # Same error as above.
$ ulimit -HS -r 40; mpd --no-daemon --stderr --verbose
ulimit: can't raise hard limits
config_file: loading file /home/l-lin/.config/mpd/mpd.conf
libsamplerate: libsamplerate converter 'Fastest Sinc Interpolator'
vorbis: Xiph.Org libVorbis 1.3.7
opus: libopus 1.5.2
hybrid_dsd: The Hybrid DSD decoder is disabled because it was not explicitly enabled
simple_db: reading DB
input: Input plugin 'qobuz' is not configured: No Qobuz app_id configured
curl: version 8.8.0
curl: with OpenSSL/3.0.13
inotify: initializing inotify
event: RTIOThread could not get realtime scheduling, continuing anyway: sched_setscheduler failed: Operation not permitted
inotify: watching music directory

✅ No music available on reboot

When starting my computer, I cannot start playing music directly. I still need to:

$ cd "${HOME}/Music"
$ for f in *.mp3; do mpc add "${f}"; done

That’s not really convenient…

I’m not sure why, maybe it’s because I’m launching mpd with hyprland and not with systemd?

A better way to add songs is to execute the following:

$ mpc add $(mpc ls)

That will include all the folders in ${HOME}/Music.

Knowing this, I can update the script that launch mpd to execute this command afterwards.