Hi Ian, Ian Eure <[email protected]> writes:
[...] >> 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. Yeah, it'd be nice to have some fields to add drop-in configs for pipewire and wireplumber to extend it more easily, and maybe rename that extra-content field to something more descriptive (asoundrc?). [...] > 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. I found out the implicit default for PipeWire is 48 kHz. > 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 Thanks for the links, they helped. So setting default.clock.rate will change the rate globally, while setting the allow-rates will let PipeWire use these rates to match a source when, and that is not explained much around, there is no mixing going on (single application outputting audio). If many streams need to be mixed then it falls back to use default.clock.rate. [...] > 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. Yes, my motherboard has some ALC4080 chip which supports up to 384 kHz, while the hi-fi amplifier has a sampling rate of up to 192 kHz on its optical (toslink/SPDIF) input. I've found out that for some reason there is some crackling when pushing it all the way to 192 kHz; I'm not sure if the onboard audio SPDIF port (it does not happen when using the analog output) or the amplifier DAC is to blame, but dialing it down to 96 kHz gives a clean signal. So my solution now looks like this: --8<---------------cut here---------------start------------->8--- # file: ~/.config/pipewire/pipewire.conf.d/10-sample-rates.conf # Set a higher sampling rate (the default is 48 kHz) for # high-resolution music. # 192 kHz produces some crackling when using the SPDIF output, despite # the Totem Kin amplifier's DAC advertised support for it; 96 kHz is # clean. context.properties = { default.clock.rate = 96000 default.clock.allowed-rates = [ 44100, 48000, 96000 ] } --8<---------------cut here---------------end--------------->8--- # file: ~/.config/wireplumber/wireplumber.conf.d/sample-rates.conf # Customize some higher rates for the Asus Strix ROG onboard ALC4080 # sound chip. monitor.alsa.rules = [ { matches = [ { node.name= "alsa_output.usb-Generic_USB_Audio-00.HiFi__Speaker__sink" } ] actions = { update-props = { audio.rate = 192000 audio.allowed-rates = [ 44100, 48000, 96000, 192000, 384000] } } } ] --8<---------------cut here---------------end--------------->8--- And then 'herd restart pipewire' (and sometimes I have to follow with 'herd restart wireplumber', as there seems to be a race) gives me a rate that goes to 192 kHz when using the analog output of the ALC4080 when playing hi-res FLAC or 96 kHz if using its SPDIF output instead. Thanks for the help! -- Maxim
