I'm currently experiencing crackling audio with headphones in Ubuntu 20.04. This issue only occurs with headphones, but multiple sound devices, doesn't occur with speakers. I've tried multiple listed fixes for this issue however none of them seem to work. The most common fix seems to be power saver related fixes, this doesn't seem to change the issue. What makes this issue weird is if there's no audio playing, i open up firefox, play, for example, a youtube video and mute it, but leave it running, the programs that i have audio crackling in no longer have audio crackling. If i then pause the video, the crackling remains fixed until i stop the audio in the program and resume it. If i start with playing audio in a program with crackling, play a youtube video, and then stop the audio from the program with crackling, the crackling remains.
The two programs that I have noticed this issue occurring with has been discord and spotify. I have tried installing discord through multiple places, however spotify has just been through the ubuntu software program.
If you have any ideas or suggestions let me know and I'll try them out ASAP. For now I'll just be leaving a short youtube video running the background, muted and on loop.
EDIT:
Looking into this further and it appears that not all sites in firefox that use audio cause this fix to occur. Some notable ones that have issues are spotify, soundcloud, and videoshub.com. Sites that i tried and it did fix the issue have been youtube, twitter videos, vimeo, and plex. so far i haven't found a audio only service that causes the fix.
Edit2:
Still looking into this. This fix so far only seems to be limited to firefox. I've tried running chromium and playing a youtube video, the crackling is still there. I've tried downloading a youtube video and playing it through VLC, the crackling is still there. I've also tried messing with the bitrate in pulseaudio, increasing or decreasing it doesn't seem to change anything.