Mpd, pipewire and dinit. Am I doing this right?
Just wanted to share my experience and maybe get some feedback on my methods as I'm not sure if I did this at all right, it was hard to find documentation in many cases, everything seeming to be systemd-focused.
So first I installed mpd and mpd-dinit, as well as cantata for an interface with pacman.
I then took a lengthy detour trying to get mpd to run as a user service, which I could probably now due but I think having it run as the mpd user is better (?).
I was having a weird issue where I was getting no errors in the logs but when opening cantata and trying to play something I got no audio, only response I got was the volume in cantata would snap to 0% when clicking play. Frustrating.
If I just ran mpd in a console (as my user) it would work no problem.
So I figured the issue was something along the lines of: pipewire-pulse is running as my user, so mpd won't have access to it... which doesn't really make sense I don't think, because I'm pretty sure by default mpd-dinit will run mpd as root.
Anyway, my solution in the end was as follows:
1) Edit /etc/mpd.conf, add the following:
user "mpd"
audio_output {
type "pulse"
name "My Pulse Output"
}
Would it be better to create a home directory for mpd and put the edited mpd.conf in /home/mpd/.mpdconf?
I'm assuming if mpd receives an update the mpd.conf in /etc/ will be overwritten.
2) Create tcp.conf in /etc/pipewire/pipewire-pulse.conf.d and put this in it:
pulse.properties = {
# the addresses this server listens on
server.address = [
#"unix:native"
#"unix:/tmp/something" # absolute paths may be used
"tcp:4713" # IPv4 and IPv6 on all addresses
#"tcp:[::]:9999" # IPv6 on all addresses
#"tcp:127.0.0.1:8888" # IPv4 on a single address
#
#{ address = "tcp:4713" # address
# max-clients = 64 # maximum number of clients
# listen-backlog = 32 # backlog in the server listen queue
# client.access = "restricted" # permissions for clients
#}
]
#pulse.min.req = 256/48000 # 5ms
#pulse.default.req = 960/48000 # 20 milliseconds
#pulse.min.frag = 256/48000 # 5ms
#pulse.default.frag = 96000/48000 # 2 seconds
#pulse.default.tlength = 96000/48000 # 2 seconds
#pulse.min.quantum = 256/48000 # 5ms
#pulse.idle.timeout = 0 # don't pause after underruns
#pulse.default.format = F32
#pulse.default.position = [ FL FR ]
# These overrides are only applied when running in a vm.
vm.overrides = {
pulse.min.quantum = 1024/48000 # 22ms
}
}
So at this point mpd seemed to be functioning properly. I could start it with dinitctl and connect with cantata and play no problem. And it was running as the mpd user.
However I then had an issue where pavucontrol wouldn't connect to pipewire-pulse at all.
So I found and edited /etc/pulse/client.conf and uncommented this line:
auto-connect-localhost = yes
And now everything seems to work fine.
I'm just wondering if anyone has any ideas on whether I really messed some stuff up here, or went about it in a dumb way.