1
0
Fork 0

Make low latency audio optional, hopefully to fix speaker crackling

This commit is contained in:
Andre Newman 2024-03-26 15:50:32 -04:00
parent efcdc1e8c0
commit 675e1a9f47
3 changed files with 18 additions and 15 deletions

View file

@ -19,9 +19,9 @@ with lib;
"io.github.celluloid_player.Celluloid" "io.github.celluloid_player.Celluloid"
"org.kde.krita" "org.kde.krita"
"org.kde.KStyle.Adwaita//5.15-23.08" # Retrieved from https://docs.flatpak.org/en/latest/desktop-integration.html "org.kde.KStyle.Adwaita//5.15-23.08" # Retrieved from https://docs.flatpak.org/en/latest/desktop-integration.html
"org.kde.KStyle.Adwaita//6.5" "org.kde.KStyle.Adwaita//6.6"
"org.kde.WaylandDecoration.QAdwaitaDecorations//5.15-23.08" # Replaced deprecated QGnomePlatform https://wiki.archlinux.org/title/Uniform_look_for_Qt_and_GTK_applications "org.kde.WaylandDecoration.QAdwaitaDecorations//5.15-23.08" # Replaced deprecated QGnomePlatform https://wiki.archlinux.org/title/Uniform_look_for_Qt_and_GTK_applications
"org.kde.WaylandDecoration.QAdwaitaDecorations//6.5" "org.kde.WaylandDecoration.QAdwaitaDecorations//6.6"
]; ];
}; };
}; };

View file

@ -30,17 +30,5 @@ with lib;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
liblc3 liblc3
]; ];
# Reduce audio latency per https://nixos.wiki/wiki/PipeWire#Low-latency_setup
services.pipewire.extraConfig.pipewire = lib.mkIf config.sound.enable {
"92-low-latency.conf" = {
"context.properties" = {
"default.clock.rate" = 48000;
"default.clock.quantum" = 32;
"default.clock.min-quantum" = 32;
"default.clock.max-quantum" = 32;
};
};
};
}; };
} }

View file

@ -6,7 +6,10 @@ in
with lib; with lib;
{ {
options = { options = {
host.ui.audio.enable = mkEnableOption (mdDoc "Enables audio"); host.ui.audio = {
enable = mkEnableOption (mdDoc "Enables audio");
enableLowLatency = mkEnableOption (mdDoc "Enables low-latency audio (may cause crackling) per https://nixos.wiki/wiki/PipeWire#Low-latency_setup ");
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
@ -25,5 +28,17 @@ with lib;
pulse.enable = true; pulse.enable = true;
jack.enable = true; jack.enable = true;
}; };
# Reduce audio latency per https://nixos.wiki/wiki/PipeWire#Low-latency_setup
services.pipewire.extraConfig.pipewire = mkIf cfg.enableLowLatency {
"92-low-latency.conf" = {
"context.properties" = {
"default.clock.rate" = 48000;
"default.clock.quantum" = 32;
"default.clock.min-quantum" = 32;
"default.clock.max-quantum" = 32;
};
};
};
}; };
} }