Loud blaring noise that occurs on a 2018 MacBook Air

I have the entry-level MacBook Air from 2018 that works mostly fine with RetroArch except for one issue regarding sound.

Sometimes, when I jump too much between the RetroArch interface and the game, a loud, ear-splitting, deafening noise plays in place of the game’s music. This has occurred using Snes9x and Mupen64plus. Neither the mute button (only makes the noise a little lower) nor the “mute audio” option in RetroArch seems to stop it, so my only choice is to close my laptop and quit out of RetroArch later.

I was wondering what the issue could possibly be, whether it’s something with sound or anything else. If it helps, I’m running the ROMs from a No-Intro collection in a 256 GB USB-A flash drive (formatted in FAT32) connected via a USB-C hub to my laptop.