Go to your phone settings--> sound--> auto haptic . Then uncheck the game in which you hear this cackling noise. I had the same problem and this solved the issue.
Hope this helps. If not, check if you hear the same noise when you connect earphones. If you don't then it's definitely a hardware issue.