You are not logged in.

#1 2024-09-11 21:17:37

Steven Loving
Member
Registered: 2024-05-23
Posts: 4

Is anyone struggling with distorted audio in the past few weeks?

As of a couple of weeks ago, I started to experience the following weird issue:

I have firefox (full screen, sway wm) on my main monitor, and mpv playing a video full screen on the other monitor.

Whenever firefox has to do 'work', like load a busy page, the audio in mpv becomes distorted for like a half second. It sounds like a record scratch.

I'm 100% sure it's not an artifact from the audio/video file itself. I can rewind and re-watch the same video file, and the distortion is not there.

I've been struggling to fix this problem for the past 2 weeks or so, but I'm not 100% I have fixed it.

The steps I've taken:

added ~/.config/pipewire/pipewire.conf.d/clockrate.conf

context.properties = {
    default.clock.rate = 44100
}

...and quantum.conf in the same directory

context.properties = {
    default.clock.quantum     = 4096
    default.clock.min-quantum = 2048
    default.clock.max-quantum = 8192
}

I've confirmed that these have taken effect with

pw-cli

I also disabled some things in firefox's about:config

media.webspeech.synth.enabled

(set to false)

These are all things that people on the internet have suggested.

All of this nonsense has *kinda* fixed the problem, but not really. I still occasionally get distortions. I originally installed Arch on this machine like 18 months ago, and this only started happening like 3 weeks ago or so. I don't think it's a hardware problem. My CPU is pretty recent and powerful. I have tested with two bluetooth headphones, and a pair of wired headphones, and they all produce the same results.

I get the feeling that I haven't fixed the actual problem. In particular, I don't think that I am supposed to change the whole pipewire 'quantum' thing. The fact that the problem isn't 100% fixed leads me to believe that I am chasing a red herring.

So, anyway, does anyone have any idea? Is anyone experiencing the same thing?

Offline

#2 2024-09-23 01:49:26

Steven Loving
Member
Registered: 2024-05-23
Posts: 4

Re: Is anyone struggling with distorted audio in the past few weeks?

Well a week later (and several weeks of struggle in total) I think I achieved a breakthrough.

If anyone is experiencing the same symptoms as me, here's what I've done to remedy things:

1) clock rate should be 44.1khz (see original post)

2) quantum values should be minimum 4096, default 4096, and max 8192 (again, see original post)

3) ~/.config/pipewire/pipewire.conf.d/rt-module.conf:

context.modules = [
{   name = libpipewire-module-rt
    args = {
        nice.level = -20
    }
    flags = [ ifexists nofail ]
}
]

(the firefox speech synthesis thing seems to have been a red herring)

Conclusion: I'm exhausted, confused, but delighted that my sound finally works well.

I don't understand why all this happened in the first place. As of a few weeks ago my sound worked fine, and I didn't change anything. My sound hardware can't be the culprit, because I have tested three different sound cards (motherboard sound with wired headphones, USB sound card with wired headphones, and bluetooth PCI-E card with two different BT headphones/buds).

My CPU isn't the fanciest in the world but it's not anemic (ryzen 4600G). And this is obviously a CPU usage problem, because the distortion only happens when a program like Firefox does work, while another program (mpv) is playing a video.

My guess? A bug in pipewire, or the kernel. I would file a bug report, but I think it would sound too nebulous to be helpful.

But, all's well that ends well, because now I can watch a video in MPV on one monitor, and load a website in Firefox on another monitor, and it doesn't cause a record scratch noise.

Offline

Board footer

Powered by FluxBB