Letting other local users access your PipeWire PulseAudio instance

Posted on .

Some time ago I blogged about how to let other users connect to your PulseAudio instance. This can be quite useful to, for example, run your usual web browser as a separate user while allowing it to properly play online videos. With the arrival of Fedora 34, PulseAudio has been replaced by PipeWire but, luckily, PipeWire aims to be a drop-in replacement for PulseAudio. The question is: can it also listen on a TCP port like the PulseAudio daemon does and can we make other users connect to it? And the answer is yes.

The first step is configuring PipeWire to launch the PulseAudio module using a TCP port in addition to the normal Unix socket. For that, you’ll likely find a sample PipeWire configuration file in /usr/share/pipewire/pipewire-pulse.conf that you can copy to the $HOME/.config/pipewire directory for your normal user. Once copied, edit that file and find the PulseAudio compatibility module configuration section. In it, add the TCP port to the list of server addresses. The section text could look like this:

    {   name = libpipewire-module-protocol-pulse
        args = {
            # the addresses this server listens on
            server.address = [
                "unix:native"
                "tcp:127.0.0.1:4713"
            ]
            #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
        }
    }

The line you have to add is the one containing tcp:127.0.0.1:4713. Port 4713 is the one normally used by PulseAudio.

Finally, when launching an application as another user you need to tell it to connect to that PulseAudio server. The easiest way is using an environment variable called PULSE_SERVER.

PULSE_SERVER=tcp:127.0.0.1:4713
export PULSE_SERVER
Load comments