From 9faaddc232a69603383c44eb3b8ecf8c9be849e7 Mon Sep 17 00:00:00 2001 From: xunuwu Date: Sun, 18 May 2025 14:25:17 +0200 Subject: [PATCH] set pipewire rate and quantum hopefully will remove all that annoying crackling i get in some games --- sys/profiles/services/pipewire.nix | 38 ++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/sys/profiles/services/pipewire.nix b/sys/profiles/services/pipewire.nix index e30ef40..c21da5b 100644 --- a/sys/profiles/services/pipewire.nix +++ b/sys/profiles/services/pipewire.nix @@ -1,6 +1,4 @@ -{inputs, ...}: { - imports = [inputs.nix-gaming.nixosModules.pipewireLowLatency]; - +{ services.pipewire = { enable = true; alsa.enable = true; @@ -8,6 +6,38 @@ jack.enable = true; pulse.enable = true; - lowLatency.enable = true; + extraConfig = let + rate = 48000; + min-quantum = 512; + max-quantum = 1024; + in { + pipewire."92-quantum"."context.properties" = { + "default.clock.rate" = rate; + "default.clock.quantum" = min-quantum; + "default.clock.min-quantum" = min-quantum; + "default.clock.max-quantum" = max-quantum; + }; + + pipewire-pulse."92-quantum" = let + qr = "${toString min-quantum}/${toString rate}"; + in { + "context.properties" = [ + { + name = "libpipewire-module-protocol-pulse"; + args = {}; + } + ]; + "pulse.properties" = { + "pulse.default.req" = qr; + "pulse.min.req" = qr; + "pulse.max.req" = qr; + "pulse.min.quantum" = qr; + "pulse.max.quantum" = qr; + }; + "stream.properties" = { + "node.latency" = qr; + }; + }; + }; }; }