I hear crackling or buzzing when sounds are playing
If you hear crackling or buzzing when sounds are playing on your computer, you may have a problem with the audio cables or connectors, or a problem with the drivers for the sound card.
Check that the speakers are plugged in correctly.
If the speakers aren't fully plugged in, or if they are plugged into the wrong socket, you might hear a buzzing sound.
Make sure the speaker/headphone cable isn't damaged.
Audio cables and connectors can gradually wear with use. Try plugging the cable or headphones into another audio device (like an MP3 player or a CD player) to check if there is still a crackling sound. If there is, you may need to replace the cable or headphones.
Check if the sound drivers aren't very good.
Some sound cards don't work very well on Linux because they don't have very good drivers. This problem is more difficult to identify. Try searching for the make and model of your sound card on the internet, plus the search term "Ubuntu", to see if other people are having the same problem.
You can run sudo lspci -v in the Terminal to get more information about your sound card.