Un-muting specific channel with pipewire / wireplumber

I have a problem with my Sound Blaster Z PCI sound card that I can’t wrap my head around.

Whenever I boot my machine I have no sound. This is not specific to NixOS, this happens on every distro I tried.

I narrowed the problem down to my “Front” channel being muted every time I reboot the system. So my usual fix is to use alsamixer to un-mute the channel and everything is golden. The problem is that this is not being saved or loaded by the alsa store and restore services.

My workaround was to create my own services that have different timings (meaning the restore service just waits for 15s and then runs the restore command) but that felt like, well, a workaround and not actually fixing the issue.

This is the “audio” part of my config excluding my workaround services:

  hardware.pulseaudio.enable = false;
  security.rtkit.enable = true;
  services.pipewire = {
    enable = true;
    alsa = {
      enable = true;
      support32Bit = true;
    };
    pulse.enable = true;
    wireplumber.enable = true;
  };

  environment.systemPackages = with pkgs; [
    jamesdsp
    pavucontrol
    alsa-utils
  ];

My question is: What should I do to actually fix the problem? Am I even supposed to use alsa to fix my issues or is there something else I should consider? I found alsa.enablePersistence while looking through the nixpkgs source but idk if that is helpful.

I’m relatively new to linux and especially NixOS so if you want to help it would be much appreciated if you could not only tell me what to do but also why.

Thank you for your time!

WirePlumber saves the soundcard volume settings in ~/.local/state/wireplumber/default-routes. As you unmute the Front channel you should see this file change. Pipewire (and therefore WirePlumber) are systemd user services, so they can only control the volume once you have logged in.

The system service alsa-store.service will restore settings from /var/lib/alsa/asound.state at boot time. But they will get changed again once your user’s wireplumber.service starts.

The hardware.alsa.enablePersistence option seems to be a new thing from nixos-unstable.

I would start by checking what WirePlumber is writing to its state files.

Hey thanks for your input and sorry for my late reply. Things happened in the meantime and I decided to switch sound card for good. The sound blaster z was more trouble than it was worth. I’m running a Focusrite Scarlett which works (almost) flawlessly.

Thanks for you input tho. Much appreciated.

No problem @schmiggolas.

For the Focusrite Scarlett, you can add this NixOS configuration to enable more controls in ALSA mixer (e.g. phantom power on/off).

{
  boot.extraModprobeConfig = ''
    # Enable ALSA control panel for Scarlett Gen 3 Solo
    options snd_usb_audio vid=0x1235 pid=0x8211 device_setup=1
  '';
}

You will probably need to change the pid= value to match the model that you have. Find it by running lsusb | grep 1235:.

1 Like

Thanks again, @rvl
I don’t really need software control for that stuff. I prefer to just use the buttons on the device itself. Thanks for the info anyways. Maybe this is useful for someone else.