You are not logged in.

#1 2024-04-11 21:34:33

43615
Member
Registered: 2022-01-19
Posts: 34

Firefox audio input stuttering

Using PipeWire with the default sample rate set to 192k, which matches the hardware. Playback in Firefox works perfectly, but recording results in constant stuttering (speech barely intelligible).
I suspect that the input sample rate might be too high (pw-top shows 192k) and some buffer can't keep up. Any suggestions?

Offline

#2 2024-04-11 21:47:44

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,820

Re: Firefox audio input stuttering

("normal" mic) input is never going to be 192k realistically. you could mess around with headroom buffers https://wiki.archlinux.org/title/PipeWi … rt_playing

Generally speaking, the vast majority of media you'll be consuming will be 44kHz/48kHz you're just wasting CPU upsampling to 192k "just cause". There's really little point to setting this globally to that value.

Last edited by V1del (2024-04-12 21:40:24)

Offline

#3 2024-04-19 21:30:12

43615
Member
Registered: 2022-01-19
Posts: 34

Re: Firefox audio input stuttering

Sorry for getting back so late, I had not subscribed to the topic and didn't care that much.

The wiki page you linked does not seem to be relevant as 1) the issue has nothing to do with multiple streams and 2) I don't even have that service running (and that config dir doesn't exist either).

I know that audiophile stuff is mostly BS, but I still paid for the whole speedometer. There is nothing about this that fundamentally can't work. I know that this is a specific Firefox issue since other applications can handle it fine.

As I'm quite unfamiliar with audio on Linux, could you suggest some options in PipeWire or Firefox to allow it to run smoothly or restrict Firefox to 48k input? The about:config parameter "media.resampling.enabled" does not make a difference.

Offline

#4 2024-04-19 22:46:23

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,820

Re: Firefox audio input stuttering

The section I linked is for illustrating the relevant option that can affect the buffer size FF has available. Try it out, other avenues are https://gitlab.freedesktop.org/pipewire … ze-quantum

What output do you get from pw-top when running into the problematic situation?

Generally speaking you can't "restrict" firefox to 48khZ if you are not globally configuring 48kHz to be an allowed sample rate. Your device is opened at one sample rate and then everything else has to be sampled up or down to the relevant target rate the device is active on, the only way to change that is to halt playback/recording completely and then switching rate, which is what the general rate selection setting will do: .https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Config-PipeWire#setting-sample-rates

You might be able to influence just firefox directly with e.g.

PULSE_LATENCY_MSEC=30 firefox

Last edited by V1del (2024-04-19 23:09:10)

Offline

#5 2024-04-20 00:10:01

43615
Member
Registered: 2022-01-19
Posts: 34

Re: Firefox audio input stuttering

I have now scaled up all of the quantum values by 4 to match the 4x higher sample rate (same duration if I understood correctly). Recorded audio is still choppy.

When recording, pw-top shows a rate of 192k. This is not the case during playback, where it uses the native 48k of the content. I had already set the allowed rates to [ 48000 96000 192000 ] alongside changing the default. I suspect that Firefox always goes to 192 when recording, but can't handle it properly. Tried several recorder web apps, always the same behavior.

Offline

#6 2024-04-20 11:54:18

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,820

Re: Firefox audio input stuttering

What other recording applications have you tried that have no issues with a 192khZ input? It simply makes no sense for the majority of  cases, almost all of them will expect some standard for a mic e.g. 16kHz and you will have to downsample the 192kHz to that value. Do you even have a mic that provides that?

Offline

#7 2024-04-20 18:44:08

43615
Member
Registered: 2022-01-19
Posts: 34

Re: Firefox audio input stuttering

Went to sleep and just tried it again after a fresh boot, now appears to work fine once it gets settled a few seconds after activating the mic. Apparently just restarting the wireplumber, pipewire and pipewire-pulse services wasn't enough to apply the config change.

The mic is analog and the interface is capable of 24-bit 192k bidirectionally (Yamaha AG03 MK2).

Applications that already worked fine previously include Audacity, a Discord client (based on Chromium) and the standalone Zoom client. According to pw-top, all of those take the full 192k. Even if necessary, resampling by integer ratios isn't computationally intensive.

Offline

Board footer

Powered by FluxBB