Hi Maxim.
Maxim Cournoyer <[email protected]> writes:
Hello!
I'm trying to have the home-pipewire-service configured to use a
sample
rate of 192 kHz instead of its default 48 kHz (for high
resolution music
playback); has anyone managed to do that?
Confusingly, the home-pipewire-configuration record has an
extra-content
field, but that gets added to ~/.config/alsa/asoundrc, a file I
can't
see documented in pipewire's documentation (it seems it's an
ALSA thing
rather than a Pipewire one? Perhaps there's a more modern file
to use
in its place, like pipewire.conf?)
I agree this seems odd. The service adds some ALSA configuration,
I do think PipeWire needs at least some of that to work, but it
seems much more useful to configure PW itself than ALSA in this
instance. Perhaps it was added because that’s the only service
that touches asoundrc at all, and if you have some other ALSA
config you need, that’s how you do it. Really seems like there
should be an ALSA service-type which pipewire extends to add its
configs, though.
What I've tried so far:
a) Added 'default.clock.rate = 192000' to
~/.config/pipewire/pipewire.conf; that broke pipewire's setup, I
think
it overrode the default configuration done in
~/.config/alsa/asoundrc,
perhaps? It was printing that there was no module
found/configured or
similar.
The ALSA configuration for Pipewire doesn’t appear to explicitly
list a sample rate. I believe the audio client application
(PipeWire in this case) asks for a sample rate, and ALSA either
provides it or doesn’t. So I think your problem lies entirely
with PipeWire.
It looks like newish PW lets you give a preference list of
samplerates; these PW docs may be helpful to you:
https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Guide-Rates
and
https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Config-PipeWire#setting-sample-rates
b) Added 'default.clock.rate = 192000' to
~/.config/pipewire/pipewire.d/10-sample-rates.conf (a "drop-in"
file). This doesn't break pipewire's setup, but it also doesn't
effect
the sample rate used; I see for example this is pw-top when
playing a
192 kHz music file:
--8<---------------cut
here---------------start------------->8---
R 61 2048 48000 135,7us 20,6us 0,00 0,00 0 S24LE 2
48000 alsa_output.usb-Generic_USB_Audio-00.HiFi__SPDIF__sink
R 93 8192 192000 40,1us 70,6us 0,00 0,00 0 S24_32 2
192000 + Musique
I think you’re going to need to get PW to the point where pw-info
is showing the sink at 192khz *before* playing anything for this
to work.
I assume you already know for certain that your audio device
supports the samplerates you’re asking for? `guix shell tree
alsa-utils -- alsa-info.sh --no-upload --stdout --with-devices'
will print pages of stuff including the supported samplerates.
-- Ian
[1]: https://issues.guix.gnu.org/66877