You are not logged in.

#1 2021-04-27 17:37:28

TheDcoder
Member
Registered: 2020-06-06
Posts: 81
Website

Multi-user audio sharing with PipeWire

Hi,

Is it possible for multiple users to share the same audio daemon when using PipeWire? You could use Unix sockets in PulseAudio to achieve this but I haven't found anything similar for PipeWire yet.

This is useful for doing things like using a separate user for Wine applications but using the same X session + audio daemon for a seamless experience.

Thank you for the help in advance!

Offline

#2 2021-04-29 16:12:39

TheDcoder
Member
Registered: 2020-06-06
Posts: 81
Website

Re: Multi-user audio sharing with PipeWire

I asked around in the #pipewire IRC channel and found out that PipeWire has support for a system-wide instance, but it needs to be enabled at build time:

17:56:04 <saivert> For system level pipewire instance the idea is that distros provide a separate package for this configuration
17:57:27 <saivert> If you build pipewire from source you need to enable the installation of the system level systemd unit files. meson setup -Dsystemd-system-service=enabled
17:58:19 <saivert> It is just a low priority use case. Most run it as their own user account on a graphical desktop
18:00:10 <TheDcoder[m]> Unfortunately it looks like the (Arch) package doesn't include system level units
18:19:41 <saivert> TheDcoder[m]: you could ask for this on the Arch bug tracker though. Even the main package could just provide the units, it is not like they have to be enabled by default.

I guess one could make an AUR package with this, but I don't see any harm in including them in the official package as they are not enabled by default.

Still, has anyone tried this system level instance of PipeWire? I visited the Access Control page on PipeWire wiki but barely understood any of it. Someone should cover this in the Arch wiki so that we can configure who gets to access the audio if running a system-level instance.

Offline

#3 2021-05-06 14:55:17

askz
Member
Registered: 2021-05-06
Posts: 1

Re: Multi-user audio sharing with PipeWire

You can add the flag by installing pipewire-git and by editing PKGBUILD before install.

Offline

#4 2021-05-06 14:57:55

TheDcoder
Member
Registered: 2020-06-06
Posts: 81
Website

Re: Multi-user audio sharing with PipeWire

Yes, I am aware of that as mentioned in my previous post, I have not tried it yet but it would be nice if someone with experience can comment and clarify things about Access Control and setup.

Offline

#5 2021-10-09 20:13:09

birdie-github
Member
From: Artem S. Tashkinov
Registered: 2021-10-09
Posts: 2
Website

Re: Multi-user audio sharing with PipeWire

In the pipewire-pulse.conf file which you can edit anywhere you want (including /usr/share/pipewire /etc/pipewire or $HOME/.config/pipewire) find the context.modules section and edit it to look like this:

    { name = libpipewire-module-protocol-pulse
        args = {
            # the addresses this server listens on
            server.address = [
                "unix:native"
                "tcp:4713"                          # IPv4 and IPv6 on all addresses
            ]

Now export an environment variable anywhere you want (see https://wiki.archlinux.org/title/system … _variables ):

PULSE_SERVER=tcp:127.0.0.1:4713

You're good to go!

P.S. Sorry for reviving an old topic but Google features it prominently when searching for pipewire multi user ;-)

Last edited by birdie-github (2021-10-09 20:22:03)

Offline

#6 2021-10-11 22:51:10

TheDcoder
Member
Registered: 2020-06-06
Posts: 81
Website

Re: Multi-user audio sharing with PipeWire

birdie-github wrote:

P.S. Sorry for reviving an old topic but Google features it prominently when searching for pipewire multi user ;-)

No problem, thanks for sharing! Perhaps it can be added to the wiki smile

P.S Good to know that I have good SEO skills wink

Offline

#7 2022-04-19 04:37:23

birdie-github
Member
From: Artem S. Tashkinov
Registered: 2021-10-09
Posts: 2
Website

Re: Multi-user audio sharing with PipeWire

I've written a script which does all of that automatically without the need to edit any files (exporting PULSE_SERVER for other users is still necessary):

https://github.com/birdie-github/useful … audio-conf

What it does:
1. Loads module-native-protocol-tcp which allows connections only from 127.0.0.1
2. Loads module-x11-bell to have an audible bell under X.org/X11
3. Extends the list of available frequencies for output devices from 44100 to 48000, 96000, 44100 (will be used automatically depending on the device capabilities)
4. Set the default quantization rate to 48KHz.

Apparently no one wants to edit the Wiki page (or Examples which doesn't seem to be popular or maintained).

Last edited by birdie-github (2022-04-19 04:39:56)

Offline

#8 2022-04-19 22:15:12

joanbrugueram
Member
Registered: 2018-11-12
Posts: 20

Re: Multi-user audio sharing with PipeWire

This may be obvious to some, but there's a simple solution if you have a single "player" user that plays audio, but you want to keep the audio while switching to other users for auxiliary tasks on other ttys, and does not require getting into the configuration rabbit hole: Just add the "player" user to the "audio" group. This will allow it to keep control of the audio devices on any tty, even if another user is logged in.

The downside of this, is that it is not seamless, i.e. only that user will be able to play audio, change the volume, etc., though you may be able to do some of those tasks with sudo, e.g. with something like:

sudo -u player env XDG_RUNTIME_DIR=/run/user/1234 pactl get-sink-volume @DEFAULT_SINK@

Offline

#9 2022-06-09 10:30:10

plaplan
Member
Registered: 2022-06-09
Posts: 1

Re: Multi-user audio sharing with PipeWire

since this topic pops up first in google

# cp /usr/share/pipewire/pipewire-pulse.conf /etc/pipewire/
# vi /etc/pipewire/pipewire-pulse.conf
pulse.properties = {
    # the addresses this server listens on
    server.address = [
        #"unix:native"
        "unix:/tmp/pulse-socket"              # absolute paths may be used
# Extra modules can be loaded here. Setup in default.pa can be moved here
context.exec = [
    { path = "/bin/chmod"  args = "go+w /tmp/pulse-socket" }

Offline

Board footer

Powered by FluxBB