feat(sound): allow dynamic clock rates

This commit is contained in:
oddlama 2023-09-07 20:27:14 +02:00
parent f56fac68ac
commit a14817d2ab
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A

View file

@ -3,7 +3,14 @@
pkgs,
...
}: {
environment.systemPackages = with pkgs; [pulseaudio pulsemixer];
# Helpful utilities:
# Show pipewire devices and application overview or specifics
# > wpctl status; wpctl inspect <id>
# View real time node and device statistics
# > pw-top
# Show actual used playback stream settings
# > cat /proc/asound/card*/pcm*p/sub*/hw_params
sound.enable = false; # ALSA
hardware.pulseaudio.enable = lib.mkForce false;
security.rtkit.enable = true;
@ -13,22 +20,30 @@
jack.enable = true;
pulse.enable = true;
wireplumber.enable = true;
#config = {
# pipewire."context.properties"."default.clock.allowed-rates" = [
# 44100
# 48000
# 88200
# 96000
# 176400
# 192000
# 358000
# 384000
# 716000
# 768000
# ];
# pipewire-pulse."stream.properties"."resample.quality" = 15;
# client."stream.properties"."resample.quality" = 15;
# client-rt."stream.properties"."resample.quality" = 15;
#};
};
environment.systemPackages = with pkgs; [pulseaudio pulsemixer];
environment.etc = {
# Allow pipewire to dynamically adjust the rate sent to the devices based on the playback stream
"pipewire/pipewire.conf.d/99-allowed-rates.conf".text = builtins.toJSON {
"context.properties"."default.clock.allowed-rates" = [
44100
48000
88200
96000
176400
192000
];
};
# If resampling is required, use a higher quality. 15 is overkill and too cpu expensive without any obvious audible advantage
"pipewire/pipewire-pulse.conf.d/99-resample.conf".text = builtins.toJSON {
"stream.properties"."resample.quality" = 10;
};
"pipewire/client.conf.d/99-resample.conf".text = builtins.toJSON {
"stream.properties"."resample.quality" = 10;
};
"pipewire/client-rt.conf.d/99-resample.conf".text = builtins.toJSON {
"stream.properties"."resample.quality" = 10;
};
};
}