I have an HP ENVY 15 laptop with Windows 8.1 that I've been using for two years (forced upgrade to 8.1 sometime during then), and in the past few months, it started doing this.

So, for quite a few months now, when I am playing Dota 2 or watching youtube videos, my computer will suddenly lag and a screeching noise will come through my headphones. It essentially freezes up and I have trouble getting the mouse and keyboard to respond as well. After about a minute of screeching and intense lag, it slowly starts working again.

I searched the internet and found this archived thread about an ASUS laptop that was experiencing the same problem as mine. http://rog.asus.com/forum/archive/index.php/t-1496

In that thread, they seemed to think the network drivers or Mcafee was causing the problem. I don't have Mcafee, and I updated my Realtek LAN drivers, and the problem has not gone away. In that thread, someone posted a youtube video showing the lag, and it is exactly the same thing that is happening to me:
At 1:35 and 2:10, this is the exact awful sound I'm hearing, accompanied by insane stuttering on my computer.

Here is my msinfo32.nfo file for those interested. I'm not sure why Google Drive thinks it's an audio file but it can be downloaded.

I also found an old thread where someone seems to be experiencing the same thing, and it's the exact same symptoms. Thankfully, I guess this means that it isn't a hardware issue.

Random CPU spikes and performance lag - Windows 7 Help Forums