Copy pasting this from my arch forums post with small edits because nobody replied to me there
I have this weird issue where the builtin speakers work fine until I plug something into the 3.5mm jack and unplug it. The audio jack output is fine, but after unplugging it, the builtin speakers start sounding very scratchy and crackly. I guess I can only describe it as feeling like the diaphragm is damaged. I am guessing this has to do something with sample rate, as I had a similar but much less intense audio quality issue happen ALL the time on both the builtin speakers and the audio jack, which I fixed by setting the sample rate to 48kHz from 44.1. This happens on all linux distros I tried, even an archiso liveusb with very minimal alsa (I used speaker-test to verify the issue).
Any help? My laptop is an Asus ROG GL504.