We have a PC running Manjaro which has two intended roles:
- A general purpose desktop that everyone in my family uses for a variety of purposes (mostly media and games)
- As a headless music server running both MPD and spotifyd
The desktop application needs to use pulseaudio for sound, since increasingly many apps only support that (e.g. Firefox).
The music server daemons (MPD and spotifyd) start at boot time, and run as their own application-specific user (i.e. not root, but also not associated with any human user).
If MPD or spotifyd are configured to use ALSA, then whichever one starts first gets exclusive control of the audio device, and sound doesn’t work for the other daemon, nor desktop apps. If those apps are configured to use pulseaudio with TCP streaming, then they only work when someone is logged in.
One solution is to use Pulseaudio in system-wide mode[/url], but this is not recommended (and not an officially supported configuration).
So I’m trying to figure out what the “right” way to do this is. Based on my understanding (could be wrong!), I think there are two possible solutions:
- Have the application-specific accounts for MPD and spotifyd be able to launch their own instance of pulseaudio when they need the audio device (i.e. mimic what would happen when a human user logs in), or
- Have the MPD and spotifyd daemons “share” ALSA with pulseaudio. I think the way to do this is to configure ALSA’s “dmix” facility (i.e. the main way multiple ALSA apps shared the audio device). But I’m not exactly sure how to do this (I struggle with ALSA’s config syntax).
Any Linux sound config experts out there who can help?