You are not logged in.

#1 2023-09-19 15:27:03

geekmiki
Member
Registered: 2011-10-10
Posts: 72

[SOLVED]Pipewire not changing sample rate on the fly

Hi,

I have configured Pipewire as follows in order to change sample rate depending on what is being played:
in /etc/pipewire.conf

default.clock.rate = 48000
default.clock.allowed-rates = [ 48000 44100 96000 192000 ]

Whatever I play (44.1khz, 48khz, 96khz) the output is at 48khz.
in pw-top:

R   51   1024  48000  98.5us  22.6us  0.00  0.00    0    S24LE 2 48000 alsa_output.usb-FIIO_FiiO_USB_DAC-E10-01.analog-stereo
R   32      0      0  37.5us  25.8us  0.00  0.00    0    S16LE 2 44100  + 32
I   77      0  44100  35.2us  31.1us  0.00  0.00    0     F32P 2 44100  + mpv

What I am doing wrong?
Thank you in advance.

Last edited by geekmiki (2023-09-19 17:07:38)

Offline

#2 2023-09-19 16:05:41

ua4000
Member
Registered: 2015-10-14
Posts: 432

Re: [SOLVED]Pipewire not changing sample rate on the fly

comment out default.clock.rate and restart.
You set a fixed global sample rate.

edit: https://wiki.archlinux.org/title/PipeWire explains the difference.

Last edited by ua4000 (2023-09-19 16:07:39)

Offline

#3 2023-09-19 16:20:00

geekmiki
Member
Registered: 2011-10-10
Posts: 72

Re: [SOLVED]Pipewire not changing sample rate on the fly

Thank you!
Commenting out the global sample rate fixed it.

EDIT: Actually, no or partially.
After rebooting, if the first file I play is at 44.1khz, it will switch. If I play a 48khz file thereafter pipewire will be "stuck" at 48khz, independently of what I play (44.1, 48, 96).
Restarting pipewire with:

systemctl --user restart pipewire

solves the issue until next reboot

Last edited by geekmiki (2023-09-19 16:37:24)

Offline

#4 2023-09-19 16:31:22

ua4000
Member
Registered: 2015-10-14
Posts: 432

Re: [SOLVED]Pipewire not changing sample rate on the fly

While testing you stopped the playback, right ?
Rate switching will only take place, if the music stream is terminated.

Offline

#5 2023-09-19 17:07:23

geekmiki
Member
Registered: 2011-10-10
Posts: 72

Re: [SOLVED]Pipewire not changing sample rate on the fly

Ok, now I found the issue!
I was running cava in a terminal window and its process is locking the sample rate.

Thanks for your help.

Offline

Board footer

Powered by FluxBB