If you hear clearer sound with no interference, then the cable was the likely culprit. If the problems continue (and it’s possible to use another cable with your speakers or headphones), then try replacing the cable. If you still hear the unwanted noises, your PC is likely to blame.
How can I fix the computer’s screeching sound in Windows 10? Right-click the speaker icon from the notification area and select Open sound settings. How can I fix high pitch sound from speakers on PC?