r/linux_gaming Nov 23 '24

answered! Newbie here, I've tried almost all fixes, there's still constant audio crackling/popping when running games through wine, help

im desperate for any sort of fix, ive tried installing/uninstalling/reinstalling pulseaudio and pipewire and changed/added things in the .config folder

i tried to change the wine audio output after all this but it only shows pulseaudio and "built-in audio analog stereo" both of which have the crackling

should i reinstall windows to dualboot instead or is there something im missing ?

Upvotes

110 comments sorted by

View all comments

u/Delta_44_ Nov 23 '24 edited 4d ago

EDIT: Comment shortened, added user-only mode (no admin privileges required) which is suggested.

Explanation of your issue, fix below, in giant title, heh!

If you try to run pw-top, look at the "err" column and see numbers rising, you have the "xrun" issue, which was a huge topic that I invested my time in trying to understand and fix.

Before saying the thing that would actually help, I'll fill you in some details.

The crackling occurs because Pipewire sets the "requested" time (the applications tells it to have a certain latency) and (I assume you're using a laptop, like me, so weak as fuck integrated sound chip) that time is too low.

The values that you need to calculate that latency are:

  • Quantum
  • Sample Rate

You're probably familiar with the Sample Rate (you might have heard of "48000Hz").

Quantum is a different thing.
Let's say you have a quantum value of 64 for "Call of Duty", the game requests that quantum value and it tells pipewire to set the Sample Rate to 44100Hz.

The latency would be: (64 / 44100) * 1000 = 1.45ms!

That's so low, right?

Now, THE FIX!

To fix that you have to tell Pipewire "stop using stupid fookin' values and use a fixed REASONABLE value, goddamn!".

To do that, you have to open the terminal and do some commands, I'll explain them too!

Note: sudo is to invoke the administrator priviledges, you'll need it when I tell you to use it because you're going to create stuff in system folders, which you normally can't write into.

Option 1 - LOCALLY (suggested)

If you don't want to change the option system-wide, for multiple reasons (it'll work regardlessly, don't worry) use this command and create the file in your home:

mkdir -p ~/.config/pipewire/pipewire.conf.d && echo "context.properties = {default.clock.min-quantum = 1024}" | tee ~/.config/pipewire/pipewire.conf.d/pipewire.conf

Option 2 - GLOBALLY

Let's create the file with the entire stuff in it!

mkdir -p /etc/pipewire/pipewire.conf.d && echo "context.properties = {default.clock.min-quantum = 1024}" | sudo tee /etc/pipewire/pipewire.conf.d/pipewire.conf

---------------------------------------------------------------------------------------

If you followed everything correctly, just restart your computer and you'll be fine!

u/undead_fucker Nov 24 '24 edited Nov 24 '24

THANK YOU SO MUCH IT WORKED I WILL NAME MY FIRSTBORN AFTER YOU

u/Delta_44_ Nov 24 '24

Hahaha! Name's Gabriel by the way.

Glad to help, I had your problem in the past and I spent a lot of time to understand it... I'd even opened an issue on gitlab, on the pipewire's repository, and the thread is long, it's still open because if you have to set the quantum value manually there's something clearly missing.

What I wanted to do is for you to enjoy the beauty that's pipewire and the linux world as a whole.

u/undead_fucker Nov 24 '24

i can finally play dark souls 2 scholar of the first sin edition on linux

u/Delta_44_ Nov 24 '24

Damn I'm still finishing the first one, I'd tried the second, two years ago, before deciding to drop it and return to the first one (I play sagas in the right order).

The second one is harsh as hell because of the weird technical decisions, such as broken rolling, broken riposte and similar stuff... anyway, enjoy!

I'll play it too and will suffer haha

u/undead_fucker Nov 24 '24

I'm way worse at ds1 lmao, 2 is certainly harsh especially in the beginning but I personally enjoy it more (especially with the seeker of fire mod), both of them are games i frequently return to tho

u/Delta_44_ Nov 24 '24

I remember Dark Souls 2 being easier for some things, maybe it's the updated gameplay, I don't know... but the other stuff is harsher

u/undead_fucker Nov 24 '24

The mobs are comparatively harder, navigating's easier cuz it's way more linear (altho not at ds3 levels). Levelling is also easier iirc cuz of the amount of souls you get

u/Le_Singe_Nu Nov 24 '24

You've done a really good job of explaining this and, as others have noted, deserve the upvotes you received. In the Windows audio world, at least, the issue would be called a buffer underrun, where the audio processor can't process the samples in the buffer (quanta, I suppose, in Linux land) fast enough. This leads to popping, crackling and s-t-r-e-t-c--h-e-d sounds.

Your response got me thinking about FL Studio and Wine. It's fine for general production, but the drivers just don't seem to be able to cope with low-latency (i.e. 128- or 256-sample buffers), even using hardware explicitly designed to work that fast at 48/96KHz sample rates.ย 

I have to go do my research now. Maybe I can cut the only real Windows tether left for me. I have a whole PC (built from recycled parts) whose only job is to run FL Studio under Windows.

u/Delta_44_ Nov 24 '24

The weird thing is that Pipewire had even worse problems than xruns. As a matter of fact, I've never heard a single xrun until version 0.3.32 or something before 2023. Keep in mind that I was rocking the maximum samplerate, 192000Hz ๐Ÿ˜‚.

I still use my MSI laptop and the manufacturer says "Oh you can use the 192000Hz samplerate setting, it's made for it!" but I guess that it has something to do with the proprietary bullshit inside some dedicated chip...

u/Le_Singe_Nu Nov 25 '24

Probably a driver issue.ย 

To be fair though, you don't need 192KHz sample rates - no one does, really. 44.1KHz is all you need to capture the full frequency range your ears will ever detect, and anything over 48KHz makes zero appreciable difference for composition and mastering. Indeed, it can even work against a good mix.

u/Delta_44_ Nov 26 '24

Absolutely true

u/legluondunet May 30 '25

Thank you very much!

u/Delta_44_ May 30 '25

You're welcome!

u/legluondunet May 31 '25

This parameter should be set in all Linux Distributions per default, isn't it?

u/Delta_44_ May 31 '25

Eh, more like "the default shouldn't be static but pipewire should dinamically raise if it encounter errors".

I've had a talk with the devs, they said "pipewire is designed to handle it", yeah, of course, the issue is that the average user don't know that maybe it's the audio board's fault.

The issue is that, even if it's designed to handle it, quantum of 32 is FUCKING STUPID, it's like 0.1ms of latency, it's... WTF.

In my opinion, the default should be 128 or 256... it's not even a rare issue, it's common.

u/Bulkybear2 Nov 23 '24

I donโ€™t even have this issue but I love the way you explained this so even not having the issue Iโ€™m aware of it and why it happens

u/Delta_44_ Nov 24 '24

Glad to help!

u/teeeeveeeee Nov 24 '24

You can also place the config file to ~/.config/pipewire/pipewire.conf.d

Now if you distro hop, but keep the home partition, the setting is also preserved.

u/Delta_44_ Nov 24 '24

Exactly.

I place in a system folder because every package can use that setting, not just user packages.

u/teeeeveeeee Nov 24 '24

That is an advantage of course. Also, if there is more than one user account it fixes the issue for all of them at once.

u/efoxpl3244 Nov 24 '24

You are kerping this community alive. Thank you.

u/Delta_44_ Nov 24 '24

That's one of those huge compliments that just makes my year, thanks!

u/efoxpl3244 Nov 24 '24

Yeah basically this is a solution that has 10 years and you find it on some forum lol life saver.

u/Delta_44_ Nov 24 '24

Hahahah, it happens a lot.

u/FlidleyQuarkington Jul 20 '25

I love you, you have made my computer usable. Absolute legend. ๐Ÿ‘

u/Delta_44_ Jul 21 '25

I'm glad, hell yeah!

u/Travelertwo Nov 16 '25

A bit of a hail mary, but I've been having some intermittent crackling when listening to MIDI and your solution worked, until I rebooted. Now instead of crackling intermittently it's always stretched. I didn't do the global thing though, I was too overjoyed, do you think that will fix my new problem?

u/Delta_44_ Nov 16 '25

That's weird... maybe MIDI playback relies on precise latencies, thus timings. I remember a Linux game called "Fret's on fire" when, if you raised the sampling quality from 22kHz to 44kHz, everything would be raised in pitch until next reboot.

I honestly don't know, global/local configuration setting means that if you log in with another user profile the setting won't take effect, since it won't exists, it wouldn't create a difference in functionality.

Yeah maybe MIDI playback relies on latencies to create timings, I don't know.

u/JekkeyTheReal Dec 16 '25

This single config fixed my audio on wine, even over a year later your comment is still helping. tysm ๐Ÿ™

u/Delta_44_ Dec 19 '25

Heh, glad to help!

u/Disastrous_Hawktuah Mar 06 '26

You are the goat

u/Delta_44_ Mar 06 '26

Oooh, thanks!

u/SquiirtleZ Nov 23 '24

Thank you for explaining my problem in a way my smooth brain can understand ๐Ÿ™Œ๐Ÿป

u/petejones7 Apr 03 '25

You're a legend for this. I've tried multiple similar fixes in pipewire.conf but this was the one that worked for some reason.

u/Delta_44_ Apr 03 '25

Yooo, thanks man!
I tried to made the pipewire team change the default minimum value from 32 to something more reasonable like 128 or 256... to something that wouldn't require a latency of 0.2ms which is something that you wouldn't want, unless you'd like to cripple your souns, like the xruns problem.

I got hit with the "works for me and pipewire is designed to do it" (yes, but the average computer is fucking not)

u/[deleted] May 05 '25

Thank you so much! Noob here, I very much appreciated your 'paint by numbers' approach for this 'how to' post. I was having loud tearing sounds in the sound when playing a game with another app like YT running at the same time. I tried this fix, so far so good. :)

u/daexxx122 Jul 21 '25

8 months after the original post and you helped me. Thanks I will forever be grateful XD

u/Delta_44_ Jul 22 '25

I'm glad to help! That issue plagued me for a lot of time and the fix was surprisingly simple so why not tell everyone?

u/Shrungie Aug 29 '25 edited Aug 29 '25

i did this, and it made all my audio quiet, what happened? is there anything i can do?

EDIT: it also didn't actually solve my issue.

EDIT 2: i figured out the issue with the volume, nevermind.

u/noobs_revezando Oct 13 '25

Thnk, mate!

Valeu, Gabriel! <3

u/Jabbafeet Oct 16 '25

I just got myself into Linux mint and I know I'm a year out from this answer, but do you know if this still works? I'm not sure if Pulseaudio (On Pipewire) is the same as just pipewire or what the interactions are.

I've done this anyway and I'm about to reboot and check as I didn't have the pipewire folder so I made it.

Thank you!

u/Delta_44_ Oct 17 '25

it'll work don't worry. this will change pipewire-pulse minimum quantum too, and that's why I wrote this comment: games tends to request ridicolous latencies.

u/z3r0c0oLz Oct 31 '25

thank you so much. the local fix + a restart fixed everything

u/Actual-Amphibian-539 Dec 01 '25

It worked after billion years of trying to find solution to this. Thank you so much!

u/[deleted] Dec 04 '25

thank you bro still useful a year later

u/YogurtclosetOwn5322 Dec 15 '25

I am a little late to the party, and I just stumbled across this, but your fix here made it so that I can play Simcity 2000 Special Edition on Wine where the Midi files and the WAV files now play together without distortion. There is just a bit of slight popping, but nothing like it was before and it sounds a million times better!

Thank you for this fix! It is really appreciated!

u/Delta_44_ Dec 19 '25

Hell yeah!

If you're still encountering rare popping, slightly raise the value... maybe from 512 to 600, it's up to you, every hardware is different.

BTW test everything under the most extreme load you can have (tip: install "stress", it's a stress tool. From there, run stress -c 16 and play some audio) to gauge the best value.

u/YogurtclosetOwn5322 Dec 20 '25

As soon as I'm back in front of the system I'm going to definitely set those values and see how it goes. Thank you tons!!!

u/travelavatar Jan 09 '26

Hey man. Thanks for this info. Will it work with a steam deck?

u/Delta_44_ Jan 09 '26

Of course it'll work, it's still a linux distro, just a different name (based on Arch btw)... are you having problems?
It seems really unlikely and you should report the issue: the steam deck is a single piece of hardware combination, it shouldn't give this problem (everyone would have it in theory).

u/travelavatar Jan 09 '26

Yes i specifically have this with HD560S seinheiser.

Especially after sleep mode but it seems to do this to a lesser extent regardless. I got a replacement for my HD560S and the issue persists.

Sometimes it will pop for a minute annoyingly due to certain sounds overlapping and work fine for 2 hours.

Sometimes i play for an hour and then popping starts at an interval of 5 seconds somehow it feels like every 5 seconds the sound lags/stutters for a micro second.

While on PC with Bazzite it did the same thing and it was horrible. I will try to apply those solutions next time i am using the devices. Thanks

u/travelavatar Jan 10 '26

Hey man. I used your solution, not the global one the other one.

Basically just ran that huge command in Konsole/Terminal and restarted my steam deck.

The issue persists even now ๐Ÿ’€

u/Delta_44_ Jan 10 '26

If you run pw-top do you see the quantum value being 512 for a lot of things?
Is the problem fixed at least a bit? Quantify it, please.

u/travelavatar Jan 10 '26 edited Jan 10 '26

Quantum value seems to be 0 unfortunately. Did i do anything wrong?

Edit: the problem is the same. Same popping showing up every now and then after sleep, i will try something else.

u/Delta_44_ Jan 10 '26

Well, if it's "every now and then" to be safe repeat the "huge command" but change 512 to 1024

u/travelavatar Jan 11 '26

Ah but the command i used was "= 1024"

u/Delta_44_ Jan 11 '26

Hmm... can you please make a screenshot of pw-top while playing audio?

u/[deleted] Jan 13 '26

Thank you so much! After trying lots of other recommendations this was the one that finally resolved the issue for me.

u/Delta_44_ Jan 13 '26

You're welcome!

BTW this is the only real fix, other fixes are bandaids.

u/Grga34 Jan 14 '26

ะžั‚ ะดัƒัˆะธ, ะฑั€ะฐั‚!

u/pandariots Jan 15 '26

Replying from a year in the future to say that you saved me pulling my hair our after struggling with this for weeks. PRAISE THE MIGHTY TERMINAL LORD

u/Delta_44_ Jan 15 '26

Hahaha I struggled with this for AN ENTIRE MONTH!

I searched, re-searched, learned how the whole [ALSA <> Pipewire <> Wireplumber] combination works together (it's really fairly simple, they're visually nodes) and I searched a lot of things in the gitlab tracker.

Finally one day I learned about quantum and I was like "what in tarnation is this?"... alas, the answer to everyone's problems, it was.

u/KissMiasma95 Jan 21 '26

Thanks for providing a solution for a problem I've been plagued with for years.

u/Delta_44_ Jan 22 '26

You're welcome my friend!

u/ConsiderationOk3844 Jan 23 '26

My problems start happening a few minutes into using my computer. I get micro-crackles every 5-10 seconds and this hasn't helped. The err column doesn't really rise in pw-top, unless I set the quantum to something like 32, in which case the err counter going up only matches some of the crackles. Didn't use to happen until like a week ago. Arch btw. It's driving me insane

u/Delta_44_ Jan 24 '26

Hmm, if the ERR column doesn't rise, the problem might relies on some kind of driver bug.

Could you please fire Audacity or some tool to record the internal audio pointing at the final node?

I mean, record the pipewire output, not the ALSA output... all of this with the final quantum value, the one that doesn't raise ERR.

u/TrainerAgus Feb 13 '26

Appreciate a lot the explanation. It was an interesting read! Just installed Debian 13 2 days ago, and solved the audio crackling of the system, but kept happening on Wine.
Thanks to you I can finally work without the need to switch back to Windows. Thank you very much.

u/monstertrucktoadette Feb 15 '26

This feels like it's the answer, but it doesn't work for me, I don't suppose you'd have some time to help me troubleshoot bc I'm rapidly reaching the end of what I can google ๐Ÿ™ƒ

If nothing else, if I DONT see the numbers in the err line go up does this mean this isn't my problem?ย 

I don't have a first born, but will happily name my plush emu after you ๐Ÿ’š๐Ÿ˜‚

u/Delta_44_ Feb 16 '26

Hmmm... if the ERR rate doesn't go up but you still experience crackling, well... can you describe what games or applications gives you that problem and are you up to recording the internal audio?

u/monstertrucktoadette Feb 16 '26

Basicly anything that plays sound, but it's worse the more system intensive it is.

For example watching YouTube some cracking, playing audio in rthym game without using inputs worse, actually playing the game much worse.ย 

By recording the audio do you mean just sound record what I hear or something else?

u/monstertrucktoadette Feb 16 '26

Fun extra context - on a fresh install I don't get this problem until I install pulseaudio (needed to get the game to work) but it persists even if I uninstall pulseaudio again ๐Ÿ™ƒ

u/Delta_44_ Feb 19 '26

You don't need to install pulseaudio, pipewire provides the replacement.

Found the issue: pipewire substitutes pulseaudio, pipewire-pulse is inside pipewire and it's a pulseaudio server inside pipewire.

Uninstall pulseaudio.

u/monstertrucktoadette Feb 19 '26

In theroy correct!

And yet absolutely nothing I did with pipewire would make audio work in the app I was trying to use until I installed pulse, and the problem persists even when I've uninstalled it!ย 

u/Delta_44_ Feb 20 '26

What app is it? This is the most important detail.

u/monstertrucktoadette Feb 20 '26

https://yarg.in/

Everyone else I've found has just given up and run it through proton/wine where it works fine, so I'm guessing it's just something weird they've done with the programming for the Linux versionย 

u/ThamMF Mar 17 '26

You just saved me hours of googling and messing with my config. Absolute legend!!

u/Delta_44_ Mar 17 '26

I'm so glad it helped you too!

u/Nimiar Apr 02 '26

Thank you so much. I've been struggling to find a fix for this for so long! My ears are so happy! My games sound smooth again!

u/Delta_44_ Apr 03 '26

Happy to help!

u/hime_pro12 May 25 '26

OMG OMG THANKS THANKSTHANKSTHANKSTHANKSTHANKSTHANKS

u/Delta_44_ May 26 '26

Happy to help!

u/KazzJen Jul 31 '26

If I could upvote this a million times, I would. Thank you so much!

u/Delta_44_ Jul 31 '26

I am glad I could help you too

u/Red_Programer8889 Oct 30 '25

For me was better to add on Launch Options PIPEWIRE_LATENCY_MSEC=60 %command%, by the moment I used on Helldivers 2 and works fine, I tried changing the ~/.config/pipewire/pipewire-pulse.conf in quantum defaults but it didn't works

u/Delta_44_ Oct 30 '25 edited Oct 30 '25

quantum is a value of pipewire, not pipewire-pulse.

You have to put that line in ~/.config/pipewire/pipewire.conf.d/pipewire.conf

u/_Rotip309_ 5d ago

okay this broke my pipewire xd

u/Delta_44_ 5d ago

weird, describe better please

u/_Rotip309_ 4d ago

sooooo I copied and pasted both commands to make a global and local preset

then I rebooted and yeah pipewire was failing to start because of the said confiig

u/Delta_44_ 4d ago

- either you put it locally (suggested, no need to escalate priviledges and easier to modify)

  • or you put it globally

Right now Pipewire is trying to read both and fails because, conflict I guess... never tried this.
I will edit the comment to write "Option 1" and "Option 2" to avoid those mistakes in the future.

u/_Rotip309_ 4d ago

yeah prob ya should add that, I thought I had to do on both ends