First thing to check is if you have the latest MBP High Sierra Updates. There have been two supplemental updates. 1st for the CPU throttling, and 2nd for the speaker glitching.
It is going to be a cpu threading issue if both of the updates are installed and you still experience the glitch. Most likely cause is the battery manager running all of its command checks. It polls the battery state, and that poll method runs where all of its command checks lock out the cpu core it is threaded on until they finish. The process belongs to the IOKit framework, which CoreAudio also belongs in, and CoreAudio streaming and system bus processes all share the same code WorkLoop so they get threaded onto the same cpu core. There are other system bus processes too that can run a higher priority than audio. So when you get something with all these lined up, scheduled to run on the same core, then eventually the audio buffer overloads as it takes the lower priority to get done, which can cause the CoreAudio process to reset, and you get the glitch.
It's a limitation of the IOKit stuff. They just have so many processes running in the background now. Certain things definitely cause it more often. I recommend using a different browser and close Safari. Safari, iTunes, iCloud and Siri can all get a lot of background processes running that will eventually coincide with the battery manager cycle. If you have any system bus monitoring software, like a fan controller or third party battery manager, those will definitely cause the issue, so turn them off. Also check to see if you have a Bluetooth PAN network device and remove it. It is constantly pinging any iOS device around and can cause issues. It's a pain for sure. If in doubt take it back to the store, but a new unit won't fix the issues. It's OS related.