mixing sound from multiple users' processes on linux
I managed to share an user-mode pulse server among local users via TCP.
Edit /etc/pulse/default.pa
to enable the TCP module. I basically disabled auth to simplify configuration. Note there may be security implications if you aren't the only one using the computer.
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1
Restart PulseAudio, if you are using systemd, this can be done with systemctl --user restart pulseaudio
.
Note that if there are already multiple PulseAudio servers running, you may need to stop them. Otherwise only the one that started first works.
Now PulseAudio should be listening on a TCP port, this can be verified with the command ss -ltp
. You'll probably see something like this:
LISTEN 0 0 *:4713 *:*
users:(("pulseaudio",pid=3130,fd=31))
which indicates that PulseAudio is listening on the port 4713.
To configure clients, edit /etc/pulse/client.conf
and enable auto connection:
auto-connect-localhost = yes
This is disabled by default on newer versions of PulseAudio for security reasons.
Next try playing some audio, cheers!