Enhancement/Request: Per-Device sample rate control
The Request: My request is "default.clock.rate" and "default.clock.allowed-rates" have per-device restrictions.
Why: In general this behavior follows other OS's per-device defaults, and reduces sample-switching desync that can occur when switching destinations mid audio-stream.
Who does this benefit: Everyone who uses multiple devices with a wide range of supported sample rates and needs to force sample rates per-device. Or people who hot-swap audio destinations on-the-fly with sample-rate differences.
My personal reasons why id like it:
Several times I've ran into issues switching between my Speaker DAC (CM6631A) and my Front-Panel Onboard Audio (0b:00.4 Audio device: Advanced Micro Devices, Inc. [AMD] Starship/Matisse HD Audio Controller).
The DAC(CM6631A) performs wonderfully at 384khz, however the FPA is capped at 96khz, however resampling occurs in most applications due to pulseaudio incompatibilities at 48khz-96khz, so a default-rate of 48khz is better. But native applications should be able to still request 96khz.
When i leave 44.1khz - 96khz (for FPA) & 192/384khz (for DAC) in "allowed.rates" and leave the default "rate" at 384khz. When switching from DAC to FPA it sets and drops the FPA Sample-Rate initially to 44.1khz. As soon as a audio stream opens from any application(or is wired), regardless of its application-set sample rate. It jumps to 96khz (hardware) and resamples from the applications sample-rate(usually 44.1khz or 48khz) to 96khz. Resulting in clicking and popping. Occasionally with other resampling noises.
This generally doesnt happen with the DAC exclusively. however, i have noticed it when switching back to the DAC on occasion from the FPA, when pipewire was opened/restarted with FPA as the default devices, that it occurs and the DAC refuses to go back to 384khz, remaining locked at 44.1khz.
System:
OS: Linux (Archlinux)
(lib)Pipewire Version: (lib)pipewire 0.3.61
DE: Plasma 5(KDE)
Kernel version (uname -r
): 6.0.11-AMD-znver2