Speaker phat vs. phat dac, clicks only on speaker phat

Have you tried using the default asound.conf from our Speaker pHAT installer? If I use ESpeak and flip between this config file, and a generic asound.conf that pipes straight into the hardware, it makes a world of difference.

With the default config, ESpeak sounds great, but with:

pcm.!default {
    type hw
    card 0
    device 0
}

It sounds absolutely awful.

I can’t rule out a fault with your specific Speaker pHAT, but there’s definitely no design flaw since the DAC->Amp stage is all internal to the MAX97357A. We’d have to try pretty hard to introduce a flaw there.

The issue is the i2s clock abruptly starting and stopping on the Pi itself. While the DAC/Amp has built-in functionality to mitigate pops and clicks, it does suggest:

For optimal click-and-pop performance, ramp down the digital data on SDIN before powering down the MAX98357

Which loosely translates to: “Don’t stop the i2s clock abruptly at the end of your audio without gracefully ramping it down”

Stuff like ESpeak is constructed, by necessity, of very closely cropped phonemes that are organised to create words. If it’s playing these rapidly one at a time, and the i2s clock is starting and stopping with each one, the resulting mess is too much for the DAC/Amp to handle.

Similarly if you change station mid-way through a song in VLC, it will produce a horrible pop.

It seems Pulse Audio works well to help, as you found here; Speaker phat, loud clicks and removing the alsa driver - #18 by skypi

I’ve noticed with Pulse’s default configuration that ESpeak will never pop if you continually play audio, but has a timeout of 5 seconds before the audio device is closed. I could consistently play audio back to back and never hear a pop, but if I counted to five between each attempt there would always be a pop at startup (there really shouldn’t be, I wonder if Pulse is doing something weird when it opens the audio device).