NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.31k stars 13.55k forks source link

PipeWire status tracking issue #102547

Closed jansol closed 1 year ago

jansol commented 3 years ago

TL;DR: Things are generally in pretty good shape but wireplumber can't be configured via the nixos module yet. On the other hand most people won't need to change anything from the defaults.

If you are reporting something, please mention the pipewire version you are using, as it is updated very frequently. Bonus points for checking if upstream already has a fix mentioned in the commit log or release notes.

Currently on master:

Configuration

Most basic additions to configuration.nix, this should be enough for most people:

  # Remove sound.enable or turn it off if you had it set previously, it seems to cause conflicts with pipewire
  #sound.enable = false;

  # rtkit is optional but recommended
  security.rtkit.enable = true;
  services.pipewire = {
    enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;
    # If you want to use JACK applications, uncomment this
    #jack.enable = true;
  };

Some useful knobs if you want to finetune or debug your setup. Note that pipewire config keys may contain a period '.' so they need to be quoted in Nix. (combine these with the basic config above):

  services.pipewire = {
    config.pipewire = {
      "properties" = {
        #"link.max-buffers" = 64;
    "link.max-buffers" = 16; # version < 3 clients can't handle more than this
    "log.level" = 2;
        #"default.clock.rate" = 48000;
        #"default.clock.quantum" = 1024;
        #"default.clock.min-quantum" = 32;
        #"default.clock.max-quantum" = 8192;
    };
  };

Virtual Sinks/Sources

If you want to do some fancy routing with null sinks, you can define them directly in the pipewire config like this. Especially convenient if you have a multi-channel (8+, or something "weird" like 2x2, 3x2) soundcard that keeps confusing applications with too many channels or a bad channel layout. (Note: you can set those cards to the "Pro Audio" profile with pavucontrol so pipewire doesn't try to guess a wrong channel layout for them.) Note that arrays are replaced rather than merged with defaults, so you need to list any default items that you want to keep here (the dummy and freewheeling driver for JACK applications, if you have JACK support enabled):

  services.pipewire = {
    config.pipewire = {
      "context.objects" = [
        {
          # A default dummy driver. This handles nodes marked with the "node.always-driver"
          # properyty when no other driver is currently active. JACK clients need this.
          factory = "spa-node-factory";
          args = {
            "factory.name"     = "support.node.driver";
            "node.name"        = "Dummy-Driver";
            "node.group"       = "pipewire.dummy";
            "priority.driver"  = 20000;
          };
        }
        {
          # Freewheeling driver. This is used e.g. by Ardour for exporting projects faster than realtime.
          factory = "spa-node-factory";
          args = {
            "factory.name"     = "support.node.driver";
            "node.name"        = "Freewheel-Driver";
            "node.group"       = "pipewire.freewheel";
            "node.freewheel"   = true;
            "priority.driver"  = 19000;
          };
        }
        {
          factory = "adapter";
          args = {
            "factory.name"     = "support.null-audio-sink";
            "node.name"        = "Microphone-Proxy";
            "node.description" = "Microphone";
            "media.class"      = "Audio/Source/Virtual";
            "audio.position"   = "MONO";
          };
        }
        {
          factory = "adapter";
          args = {
            "factory.name"     = "support.null-audio-sink";
            "node.name"        = "Main-Output-Proxy";
            "node.description" = "Main Output";
            "media.class"      = "Audio/Sink";
            "audio.position"   = "FL,FR";
          };
        }
      ];
    };
  };

You can't currently link nodes to each other in the config, but you can adapt this script to do it for you. Replace the soundcard names and ports with whatever matches your setup:

#!/usr/bin/env bash

# ports obtained from `pw-link -io`

pw-link "Main-Output-Proxy:monitor_FL" "alsa_output.usb-Native_Instruments_Komplete_Audio_6_69BC86B9-00.pro-output-0:playback_1"
pw-link "Main-Output-Proxy:monitor_FR" "alsa_output.usb-Native_Instruments_Komplete_Audio_6_69BC86B9-00.pro-output-0:playback_2"

pw-link "alsa_input.usb-M-Audio_Fast_Track-00.pro-input-0:capture_1" "Microphone-Proxy:input_MONO"

Standalone mode (no session manager)

If you want to run a minimal pipewire instance with no session manager for automatic switching etc, you can do that as of 0.3.46 (technically pipewire supported it a bit longer than that but that's when the nixos module was adapted to account for it). This is mainly intended for systems that used to run purely JACK:

  security.rtkit.enable = true;
  services.pipewire = {
    enable = true;
    jack.enable = true;
    wireplumber.enable = false;
    media-session.enable = false;
  };

If this doesn't work it is likely because it defaults to using an alsa device called hw:0 which might not be the sound card you want to be using. You can easily fix this by overriding the device name in the "context.objects" array of the main pipewire configuration. The names and descriptions of available devices can be seen with aplay -l from the alsa-utils package. Note that you'll have to write out the full contents of the array because the default items will be replaced completely with this:

  services.pipewire.config.pipewire = {
      "context.objects" = [
        {
          factory = "metadata";
          args = {
            "metadata.name" = "default";
          };
        }
        {
          # A default dummy driver. This handles nodes marked with the "node.always-driver"
          # properyty when no other driver is currently active. JACK clients need this.
          factory = "spa-node-factory";
          args = {
            "factory.name"     = "support.node.driver";
            "node.name"        = "Dummy-Driver";
            "node.group"       = "pipewire.dummy";
            "priority.driver"  = 20000;
          };
        }
        {
          # Freewheeling driver. This is used e.g. by Ardour for exporting projects faster than realtime.
          factory = "spa-node-factory";
          args = {
            "factory.name"     = "support.node.driver";
            "node.name"        = "Freewheel-Driver";
            "node.group"       = "pipewire.freewheel";
            "node.freewheel"   = true;
            "priority.driver"  = 19000;
          };
        }
        {
          args = {
          "adapter.auto-port-config" = {
            mode = "dsp";
            monitor = false;
            position = "unknown";
          };
          "api.alsa.path" = "hw:0"; # replace with the right path for your system
          "channelmix.disable" = true;
          "factory.name" = "api.alsa.pcm.source";
          "media.class" = "Audio/Source";
          "node.description" = "system";
          "node.name" = "system";
          "node.suspend-on-idle" = true;
          "resample.disable" = true;
          };
          factory = "adapter";
        }
        {
          args = {
          "adapter.auto-port-config" = {
            mode = "dsp";
            monitor = false;
            position = "unknown";
          };
          "api.alsa.path" = "hw:0"; # replace with the right path for your system
          "channelmix.disable" = true;
          "factory.name" = "api.alsa.pcm.sink";
          "media.class" = "Audio/Sink";
          "node.description" = "system";
          "node.name" = "system";
          "node.suspend-on-idle" = true;
          "resample.disable" = true;
          };
          factory = "adapter";
        }
      ];
    };
  };

Miscellaneous

For the time being you can switch between two session managers, although there is usually no reason to. Note #159546 which intends to change the default from media-session to wireplumber since media-session is considered deprecated by upstream.

  services.pipewire = {
    # wireplumber.enable = true;
    # media-session.enable = false;
  }

For other available options, consult the upstream config templates. All config files listed there should be accessible via the nixos module as services.pipewire.config.$basename and services.pipewire.media-session.config.$basename for the daemon and the default session manager respectively.

Please help test new PRs!

Please do try out update pull requests before they are merged (if you can), it is fairly easy:

Known Problems

The issues people have previously described here should all be fixed now.

Please add a comment if something is broken (and ideally open an issue upstream if it is not a packaging problem).

eadwu commented 3 years ago

From my experience

There are other things that are pretty annoying, audio control is completely bonkers for me, alsactl/alsamixer is half broken, I have to rely on using pactl and the pulseaudio library shims to even change my audio with keybinds. Anyway just a couple of things off the top of my head.

Note that you may not experience some of my issues, because it's configuration dependent on more than just the pipewire configuration.

As of November 14, 2020, all of the issues I've listed have been resolved (on my system). HFP/HSP doesn't work the last time checked that out, as only the backend support is implemented, in case that is a deal breaker for anyone (as far as I can remember).

jansol commented 3 years ago

Did some digging and the Discord issue is fairly simple: the wrapper prepends the dependencies' paths to LD_LIBRARY_PATH, and those dependencies include libpulseaudio. So I tried making a copy of the wrapper script that prepends the pipewire pulseaudio shim's path instead of the native pulseaudio one and voilà, it works perfectly! Simply removing the libpulseaudio part from LD_LIBRARY_PATH works as well, as long as the result does not put the native libpulseaudio before the pipewire shim.

I'm guessing the Right solution to this is to wait for the pulse-bridge aka "fake" pulseaudio server in pipewire so Discord (and presumably steam) can just use the native library and everything looks like business as usual to them.

jansol commented 3 years ago

Pulse-bridge does seem to work surprisingly well: I tried stopping the pipewire service and launching it manually with pulse-bridge enabled (I have pulseaudio disabled in my nixos config so there won't be conflicts): pipewire-media-session -e pulse-bridge If steam, discord etc is launched after starting the media session, audio is working without further tweaking as expected. If they were running before this, they will likely crash or lock up when pipewire is stopped.

So for transparent support we'll need a nixos option to enable the pulse-bridge module as described upstream. Some discussion about that happened in #102514 .

The same approach could be used for the bluez5 module which is also disabled by default for now.

jansol commented 3 years ago

Upstream has deprecated the libpulseaudio.so shim and provides a systemd service to load pulse-bridge now. This makes packaging a lot easier since we don't have to patch files and there should no longer be socket conflicts with pulseaudio either.

ilya-fedin commented 3 years ago

ALSA compatibility option doesn't provide ctl.!default for some reason: https://github.com/NixOS/nixpkgs/blob/c18b90b5b90bd20c421ffe795420ad501e6613c7/nixos/modules/services/desktops/pipewire.nix#L85-L98

This leads to the impossibility to control pipewire via alsamixer :(

jansol commented 3 years ago

0.3.16 has been merged, this adds pulse-bridge which fixes most pulseaudio applications including steam and its games. (channels haven't updated yet at the time of writing though)

ilya-fedin commented 3 years ago

0.3.16 has been merged

0.3.17 just released ;)

gebner commented 3 years ago

With 0.3.17, bluetooth works out of the box for me (both HFP and A2DP). #105362

jansol commented 3 years ago

Isn't the bluez5 module disabled by default?

ilya-fedin commented 3 years ago

Isn't the bluez5 module disabled by default?

105362 enables it by the with-pulse file

gebner commented 3 years ago

Bluetooth worked for me even without the with-pulse file. HFP required enabling hsphfpdSupport (compile-time option) though.

ilya-fedin commented 3 years ago

According to the source code, it should be enabled with the pulse file: https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/0.3.17/src/examples/media-session/media-session.c#L2109-2111

And looks like it should be with-pulseaudio rather than with-pulse: https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/0.3.17/src/examples/media-session/media-session.c#L2128

gebner commented 3 years ago

Thanks, fixed the with-pulseaudio file name.

Eventually, the nixos module should also generate a pipewire.conf file (so that we can modify it). Right now, it's e.g. impossible to pass extra arguments to pipewire-media-session.

suhr commented 3 years ago

I have an issue while trying to use qjackctl with pipewire:

$ qjackctl
/nix/store/xv3g9szrk83yqizmzzaxvl45qz5sv4hh-qjackctl-0.6.3/bin/qjackctl: symbol lookup error: /nix/store/xv3g9szrk83yqizmzzaxvl45qz5sv4hh-qjackctl-0.6.3/bin/qjackctl: undefined symbol: jack_session_commands_free
ilya-fedin commented 3 years ago

Thanks, fixed the with-pulseaudio file name.

btw, imho, it is worth to replace

    sound.extraConfig = mkIf cfg.alsa.enable ''
      pcm_type.pipewire {
        libs.native = ${cfg.package.lib}/lib/alsa-lib/libasound_module_pcm_pipewire.so ;
        ${optionalString enable32BitAlsaPlugins
          "libs.32Bit = ${pkgs.pkgsi686Linux.pipewire.lib}/lib/alsa-lib/libasound_module_pcm_pipewire.so ;"}
      }
      pcm.!default {
        @func getenv
        vars [ PCM ]
        default "plug:pipewire"
        playback_mode "-1"
        capture_mode "-1"
      }
    '';
    environment.etc."alsa/conf.d/50-pipewire.conf" = mkIf cfg.alsa.enable {
      source = "${cfg.package}/share/alsa/alsa.conf.d/50-pipewire.conf";
    };

with

    sound.extraConfig = mkIf cfg.alsa.enable ''
      pcm_type.pipewire {
        libs.native = ${cfg.package.lib}/lib/alsa-lib/libasound_module_pcm_pipewire.so ;
        ${optionalString enable32BitAlsaPlugins
          "libs.32Bit = ${pkgs.pkgsi686Linux.pipewire.lib}/lib/alsa-lib/libasound_module_pcm_pipewire.so ;"}
      }
      ctl_type.pipewire {
        libs.native = ${cfg.package.lib}/lib/alsa-lib/libasound_module_ctl_pipewire.so ;
        ${optionalString enable32BitAlsaPlugins
          "libs.32Bit = ${pkgs.pkgsi686Linux.pipewire.lib}/lib/alsa-lib/libasound_module_ctl_pipewire.so ;"}
      }
    '';
    environment.etc."alsa/conf.d/50-pipewire.conf" = mkIf cfg.alsa.enable {
      source = "${cfg.package}/share/alsa/alsa.conf.d/50-pipewire.conf";
    };
    environment.etc."alsa/conf.d/99-pipewire-default.conf" = mkIf cfg.alsa.enable {
      source = "${cfg.package}/share/alsa/alsa.conf.d/99-pipewire-default.conf";
    };
gebner commented 3 years ago

Is there a reason to keep the sound.extraConfig or could we put that into alsa/conf.d as well?

ilya-fedin commented 3 years ago

Yeah, it should work with conf.d as well. You could test with alsamixer: if everything is ok, it will give you pipewire volume control instead of hardware volume control by default.

suhr commented 3 years ago

It finds out, qjackctl can be fixed with --disable-jack-session option to configure. It should be provided by default, since jack session api is deprecated: https://jackaudio.org/api/group__JackSessionManagerAPI.html

Funestia commented 3 years ago

I don't know if the following issues are nixos specific:

bbigras commented 3 years ago

With pipewire, my keyboard media keys (vol up & vol down) don't seem to work under gnome (x11).

Anyone has an idea?

ilya-fedin commented 3 years ago

Anyone has an idea?

It's a bug with restoring default device on restart https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/429

ilya-fedin commented 3 years ago

pipewire has a race condition with logind, thus adding the user to the audio group might help with some issues that happen on restart (i always add my user to the audio group to have working rtkit-daemon, so I don't know which issues it might fix exactly) https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/423

ilya-fedin commented 3 years ago

Just updated my NixOS unstable image

archseer commented 3 years ago

0.3.18 is out, fixes some more issues: https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/NEWS

Hopefully my sound card won't stutter anymore with the latest bugfixes.

jansol commented 3 years ago

0.3.18 is out, fixes some more issues: https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/NEWS

Hopefully my sound card won't stutter anymore with the latest bugfixes.

Just waiting for the nixos channels to update... #106990

archseer commented 3 years ago

Oh, I missed that, thanks :)

pushqrdx commented 3 years ago

Just updated to the latest nixos unstable (before i had almost perfectly working pipewire aside from a couple of annoyances) now i have completely broken audio, alsamixer throws this. I'd really appreciate someone's help with this

[W][000000128.554552][ctl_pipewire.c:1105 on_core_error()] alsa-plugin 0x2177300: error id:5 seq:21 res:-2 (No such file or directory): enum params id:13 (Spa:Enum:ParamId:Route) failed

And audio (if it comes out) is completely distorted and from the left channel only

ilya-fedin commented 3 years ago

Updated to the latest nixos unstable as well and I don't have any problems :man_shrugging: :thinking:

jansol commented 3 years ago

Current nixos-unstable works fine for me, but I don't really use alsa nor am I familiar with how it is supposed to work (didn't have much success when I gave it a quick try in the previous version though). @ilya-fedin can you edit the alsa bits in the OP since you seem to be familiar with it? If not, please update me on fixed/new known issues you encounter.

@bbigras plasma/gnome volume widgets aren't working at all here it seems, I think the keyboard volume buttons go through those... IIRC they are supposed to work with the fake pulse server though, not sure what the problem there is

ilya-fedin commented 3 years ago

@ilya-fedin can you edit the alsa bits in the OP since you seem to be familiar with it?

Looks like I have not enough rights :(

I know at least two problems with alsamixer (seems to be bugs in the pipewire's shim):

buckley310 commented 3 years ago

With regards to GNOME, you can convince it to work.

To get the notification icon working, you can just do a gnome reset (enter r in the alt+f2 menu) To get the media keys working systemctl --user restart org.gnome.SettingsDaemon.MediaKeys.target

Seems like there is some sort of race condition at session-startup perhaps?

buckley310 commented 3 years ago

Using this config seems to make pipewire with Gnome/x11 work just fine. Forcing the services to start instead of using socket activation.

  hardware.pulseaudio.enable = pkgs.lib.mkForce false;
  systemd.user.services.pipewire.wantedBy = [ "default.target" ];
  systemd.user.services.pipewire-pulse.wantedBy = [ "default.target" ];
  services.pipewire = {
    enable = true;
    socketActivation = false;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;
  };

(EDIT: also make sure your user account is in the audio group. See below.)

bbigras commented 3 years ago

Using this config seems to make pipewire with Gnome/x11 work just fine.

It's weird. With that config I get the notification icon and the volume overlay working but only in gdm.

Once logged in I have none and my sound doesn't work. I had no output with pavucontrol.

Maybe it's a coincidence. In my config I also had jack.enable = true.

pipewire

-- Journal begins at Mon 2020-11-23 21:17:39 EST, ends at Thu 2020-12-31 14:36:47 EST. --
déc 31 04:41:30 desktop systemd[2044]: Started Multimedia Service.
déc 31 04:41:30 desktop pipewire[2053]: Failed to receive portal pid: org.freedesktop.DBus.Error.NameHasNoOwner: Could not get PID of name 'org.freedesktop.portal.Desktop': no such name
déc 31 04:41:30 desktop pipewire[2053]: could not make thread realtime: No such file or directory
déc 31 04:41:30 desktop pipewire-media-session[2067]: could not make thread realtime: No such file or directory
déc 31 04:41:30 desktop pipewire-media-session[2067]: can't open control for card hw:1: No such file or directory
déc 31 04:41:30 desktop pipewire-media-session[2067]: can't open control for card hw:0: No such file or directory
déc 31 04:41:30 desktop pipewire-media-session[2067]: can't open control for card hw:2: No such file or directory
déc 31 04:41:30 desktop pipewire-media-session[2067]: v4l2: Cannot open '/dev/video0': 13, Permission denied
déc 31 04:41:30 desktop pipewire-media-session[2067]: v4l2: Cannot open '/dev/video1': 13, Permission denied
déc 31 04:41:30 desktop pipewire-media-session[2067]: oFono: Register() failed: org.freedesktop.DBus.Error.ServiceUnknown
déc 31 04:41:30 desktop pipewire-media-session[2067]: RegisterApplication() failed: org.freedesktop.DBus.Error.ServiceUnknown
déc 31 04:41:30 desktop pipewire[2053]: ALSA lib seq_hw.c:466:(snd_seq_hw_open) open /dev/snd/seq failed: Permission denied
déc 31 04:41:30 desktop pipewire[2053]: open failed: Permission denied
déc 31 04:41:30 desktop pipewire[2053]: can't create node: Permission denied
déc 31 04:41:30 desktop pipewire-media-session[2067]: error id:3 seq:3 res:-13 (Permission denied): can't create node: Permission denied
déc 31 04:41:55 desktop pipewire-media-session[2067]: GetManagedObjects() failed: org.freedesktop.DBus.Error.NoReply
déc 31 04:45:00 desktop pipewire-media-session[2067]: no node found for 37

pipewire-pulse

-- Journal begins at Mon 2020-11-23 21:17:39 EST, ends at Thu 2020-12-31 14:36:47 EST. --
déc 31 04:41:30 desktop systemd[2044]: Started PipeWire PulseAudio.
déc 31 04:41:30 desktop pipewire-pulse[2052]: could not make thread realtime: No such file or directory
déc 31 04:45:00 desktop pipewire-pulse[2052]: stream 0x10cef90: error no node available
déc 31 04:45:00 desktop pipewire-pulse[2052]: pulse-server 0x10aaeb0: [Firefox] ERROR command:-1 (invalid) tag:5 error:25 (Input/output error)
déc 31 04:45:44 desktop pipewire-pulse[2052]: pulse-server 0x10d0fe0: [Contrôle du volume PulseAudio] ERROR command:87 (EXTENSION) tag:12 error:19 (Operation not supported)
déc 31 04:45:44 desktop pipewire-pulse[2052]: pulse-server 0x10d0fe0: [Contrôle du volume PulseAudio] ERROR command:87 (EXTENSION) tag:13 error:19 (Operation not supported)
déc 31 04:45:44 desktop pipewire-pulse[2052]: pulse-server 0x10d0fe0: [Contrôle du volume PulseAudio] ERROR command:87 (EXTENSION) tag:14 error:19 (Operation not supported)
déc 31 04:45:44 desktop pipewire-pulse[2052]: pulse-server 0x10d0fe0: [Contrôle du volume PulseAudio] ERROR command:87 (EXTENSION) tag:15 error:19 (Operation not supported)

Here's the logs when it works:

pipewire

-- Journal begins at Tue 2020-11-24 05:22:01 EST, ends at Thu 2020-12-31 14:36:47 EST. --
déc 30 23:54:38 desktop systemd[2037]: Started Multimedia Service.
déc 30 23:54:38 desktop pipewire[2403]: could not make thread realtime: No such file or directory
déc 30 23:54:38 desktop pipewire[2403]: Failed to receive portal pid: org.freedesktop.DBus.Error.NameHasNoOwner: Could not get PID of name 'org.freedesktop.portal.Desktop': no such name
déc 30 23:54:38 desktop pipewire-media-session[2428]: could not make thread realtime: No such file or directory
déc 30 23:54:38 desktop pipewire-media-session[2428]: oFono: Register() failed: org.freedesktop.DBus.Error.ServiceUnknown
déc 30 23:54:38 desktop pipewire-media-session[2428]: RegisterApplication() failed: org.freedesktop.DBus.Error.ServiceUnknown
déc 30 23:54:49 desktop pipewire-media-session[2428]: GetManagedObjects() failed: org.freedesktop.DBus.Error.TimedOut

pipewire-pulse

-- Journal begins at Tue 2020-11-24 05:22:01 EST, ends at Thu 2020-12-31 14:36:47 EST. --
déc 30 23:54:35 desktop systemd[2037]: Started PipeWire PulseAudio.
déc 30 23:54:36 desktop pipewire-pulse[2209]: could not make thread realtime: No such file or directory
déc 30 23:55:02 desktop pipewire-pulse[2209]: pulse-server 0x1100df0: [Contrôle du volume PulseAudio] ERROR command:87 (EXTENSION) tag:12 error:19 (Operation not supported)
déc 30 23:55:02 desktop pipewire-pulse[2209]: pulse-server 0x1100df0: [Contrôle du volume PulseAudio] ERROR command:87 (EXTENSION) tag:13 error:19 (Operation not supported)
déc 30 23:55:02 desktop pipewire-pulse[2209]: pulse-server 0x1100df0: [Contrôle du volume PulseAudio] ERROR command:87 (EXTENSION) tag:14 error:19 (Operation not supported)
déc 30 23:55:02 desktop pipewire-pulse[2209]: pulse-server 0x1100df0: [Contrôle du volume PulseAudio] ERROR command:87 (EXTENSION) tag:15 error:19 (Operation not supported)
déc 30 23:55:02 desktop pipewire-pulse[2209]: pulse-server 0x1100df0: [Contrôle du volume PulseAudio] ERROR command:87 (EXTENSION) tag:17 error:19 (Operation not supported)
déc 30 23:55:02 desktop pipewire-pulse[2209]: Failed to mlock memory 0x7fbff6520000 32832: This is not a problem but for best performance, consider increasing RLIMIT_MEMLOCK
ilya-fedin commented 3 years ago

@bbigras try to add both your user and gdm's user to the audio group

bbigras commented 3 years ago

@bbigras try to add both your user and gdm's user to the audio group

It works. Thanks @ilya-fedin !

anna328p commented 3 years ago

I am having a problem where no app detects pulse-bridge, even if I start it manually. Everything just prints "connection refused".

ilya-fedin commented 3 years ago

I am having a problem where no app detects pulse-bridge, even if I start it manually. Everything just prints "connection refused".

There's no pulse-bridge anymore, there's only pipewire-pulse

ghost commented 3 years ago

@pushqrdx I'm hitting this as well, sound is audible but KDE audio configuration doesn't work. qjackctl works fine.

Melkor333 commented 3 years ago

pacmd also aborts with No PulseAudio daemon running, or not running as session daemon.. For some reason I have neither pipewire-pulse nor pulse-bridge in my path with pipewire installed (I only find pipewire, pipewire-media-session and some pw-* tools).

ilya-fedin commented 3 years ago

pacmd is hardcoded to work only with pulseaudio process https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/357

ilya-fedin commented 3 years ago

For some reason I have neither pipewire-pulse nor pulse-bridge in my path with pipewire installed

   ps aux | grep pipewire-pulse
ilya      1125  0.0  0.3  96388 18744 ?        Ssl  12:30   0:00 /nix/store/pl34m73jxmy2h495a8xfbc1pc82crmy5-pipewire-0.3.18-pulse/bin/pipewire-pulse
ilya      5624  0.0  0.0   6452  2240 pts/0    S+   13:29   0:00 /nix/store/134fdr0yrl4wgrrasxn9d3s8vzcm5lxq-gnugrep-3.6/bin/grep --color=auto pipewire-pulse
collares commented 3 years ago

Pipewire 0.3.19 was recently released. The bad news is that the configuration format changed, which will require some packaging changes. The good news is that mSBC (improved microphone quality) is working wonderfully if you're on kernel 5.10.X for X >= 18 or 5.11.Y for Y >= 1. If you need support on the 5.8/5.9 series, there's a patch you can apply (see previous version of this message). If you're on 5.4, you might be out of luck.

jansol commented 3 years ago

There are sample config files in the repo so changing the current module to generate a config in the new format shouldn't be too difficult. What is unclear to me is how the new config file relates to the /etc/pipewire-media-session.d/with-* files that were used to enable the compat modules. I'd like to update this ASAP for stability reasons as well (there are a bunch of very regularly occuring crashes in 0.3.18 that have been fixed in 0.3.19 AFAIK) but unfortunately I'm tied up with other things for the next few days.

collares commented 3 years ago

I asked it at https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/548. It's a peculiar configuration format: you declare "bundles" in /etc/pipewire/media-session.d/media-session.conf, but a given bundle is only enabled if a file with the same name as the bundle exists in /etc/pipewire/media-session.d/

ilya-fedin commented 3 years ago

Looks like they fixed the logind ACL race condition and the audio group workaround shouldn't be needed with 0.3.19

eadwu commented 3 years ago

Here's a subpar generation function that generally works for everything except objects (though you can see the subpar attempt). Not even sure how the language is even structured, so the quoting is left for the user to add.

  mkSPAValueString = v:
    if      builtins.isList       v then "[${lib.concatMapStringsSep " " mkSPAValueString v}]"
    else if lib.types.attrs.check v then
      "{${lib.concatStringsSep " " (mkSPAKeyValue { _SPA_DUP = v._type or "" == "_SPA_DUP"; } v)}}"
    else lib.generators.mkValueStringDefault {} v;

  mkSPAKeyValue = { _SPA_DUP ? false }: attrs: map (def: def.content) (lib.sortProperties
    (lib.mapAttrsToList
      (k: v:
      let
        keyValue = v': "${lib.escape ["="] k} = ${mkSPAValueString (v'._content or v')}";
      in lib.mkOrder (v._priority or 1000)
        (if _SPA_DUP
        then lib.concatMapStringsSep " " keyValue (v._content or [])
        else keyValue v))
      attrs));

  toSPAJSON = attrs: lib.concatStringsSep "\n" (mkSPAKeyValue {} attrs);
rien commented 3 years ago

I am having issues with an electron app (teams) not detecting any audio output, inputs are detected just fine. Other applications (firefox, mpv) can output audio just fine too.

Any way I can debug this? I guess something goes wrong during discovery?

jansol commented 3 years ago

Teams is working fine here. What does it look like in pavucontrol or one of the numerous JACK patchbays? (carla, patchage)

rien commented 3 years ago

It appears briefly (as "chromium"), but disappears after a few seconds. The weird thing is I can make a test call which start playing the ringtone (which works) and when the other end accepts the call, it gives me a notification there is no speaker detected... (without any sound).

This is how it looks in patchage (after enabling jack and rebooting). The connection from chromium is the ringtone playing. image

Connecting the Skype output channels to playback results in my microphone input going to my headphone output.

I'll try to find out how teams performs its audio discovery...

jansol commented 3 years ago

For me it obediently follows the defaults I have set in pavucontrol. Try nuking ~/.config/pipewire-media-session/* and then setting the default devices in pavucontrol before launching anything that plays audio. That fixed some applications reverting to the wrong soundcard for me.