Skip to content

Instantly share code, notes, and snippets.

@ammuench
Created December 28, 2023 03:09
Show Gist options
  • Save ammuench/164ea026909eb256ba379f9e3a99af85 to your computer and use it in GitHub Desktop.
Save ammuench/164ea026909eb256ba379f9e3a99af85 to your computer and use it in GitHub Desktop.
Fixing Crackling/Buzzing Audio on Pipewire

Fixing Crackling/Buzzing Audio on Pipewire

Quick potential fix for crackling/buzzing audio issues

Check values of these two files:

cat /sys/class/rtc/rtc0/max_user_freq
cat /proc/sys/dev/hpet/max-user-freq

If they have defaulted back to 64 for whatever resaon, that's likely causing your crackling. You can fix it by running the following commands

sudo -i
echo 2048 > /sys/class/rtc/rtc0/max_user_freq
echo 2048 > /proc/sys/dev/hpet/max-user-freq

then restart pipewire with

systemctl --user restart pipewire.service

(or you can reboot if that's easier)

This should fix the crackling!

@anohren
Copy link

anohren commented Nov 11, 2024

Not sure if it was the new values that did it, but this appears to work πŸ‘πŸ‘πŸ‘ Thanks!

While I can make a qualified guess, I haven't looked up what these values represent yet.

(Pipewire 1.2.6)

@PaddyMac
Copy link

Thank you so much! This seems to have resolved my issue as well. But how do I make this change permanent?

@anohren
Copy link

anohren commented Dec 14, 2024

That's a good question.

Another question is: if these values are necessary, why aren't they the default? And: if it's too difficult to find a default that works for all machines, then why are they reset after customization?

Maybe the answer is simply that the values should be changed through other means to be persisted. I'd prefer not to have to make my own systemd unit.

Edit:
https://www.kernel.org/doc/html/v6.10/admin-guide/rtc.html explains why 64: higher values might have adverse effects on a slow 386 πŸ™€

Less sure why it describes this API as "readonly" though:

/sys/class/rtc/rtcN … sysfs attributes support readonly access to some RTC attributes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment