You may have a bad cable...
As someone who spent almost 25 years in techsupport and repairing / building computers, a bad cable is a totally overlooked source of error and they can do some really funky stuff in your PC.
My strangest error was due to a bad cable, a few years ago i started to get distorted sounds from my headphones, it happened in games, movies, youtube or spotify but not all the time and i couldn't tie it to something.
At first it seemed to be very random, it could go days without distortion and it could happen multiple times in a 10minute window.
So I started with the obvious, updating all drives / bios etc. - did nothing.
Replaced the onboard soundcard with an old one - did nothing.
So the next step was the obvious culprit, RAM. I've repaired hundreds of computers and RAM is by far the most overrepresented source of error. It can be a bad stick or wrong settings in bios / outdated bios, but anything involving RAM is my first suspect when it comes to faulty hardware after teh obvious driver/firmware/bios upgrades. So I did a 10hour memtest and it showed 0 errors.
Now I'm starting to wonder if my mobo is fucked but that's nothing you usually have a spare one laying around and its a bit of pain in the ass to rip it out and put in a new one.
So I thought that I would just bench the shit out of my PC while watching a movie so I put on my speakers instead of my headphones so I didn't have to sit infront of the PC all day while it did, I ran cinebench, 3dmark, disc-checks and everything I could find and throw at it, it did nothing except showed that everything was fine. No bluescreens, no error messages, no distortion of the sound at any point.
So I was pretty much over it at this point, may as well buy a new Mobo and CPU and get an unwarranted upgrade while I was at it but as I was sitting there browsing for parts I heard one of my drives spin up and a second later, distortion.
The drive was an old HDD, it didn't show any errors when I benched it, it has never ever had a corrupted file on it or showed any problems what so ever, benchmarks were totally fine but for some reason, whenever the drive spun up or wrote / read data to & from the drive, it fucked up the sound.
The drive was mostly in idle mode because I rarely used it so that's why the distortion was so random and since I use headphones 99% of the time I never really hear my computer so I never made the connection to the distortion and drive spinning up.
So I swapped drives and SATA ports and the new drive had the same error, so I replaced the cable and BAM. Distortion was gone.