I'm trying to create an app that measures the audio quality, this is ideally to filter out blown out or cracking speaker who has different types of distortions, what would be the best measurement technique for that? I'm approaching this based on THD computation for different frequencies after performing FFT on my input via mic, I aim to play via the speaker, is that a good approach or I need to head into some other direction?
2 Answers
Several studies published in scientific journals such as AES show that the correlation of THD measurement with perceived sound quality is not good. This is because THD is too simple and too synthetic measure: it is more important to study the distribution of harmonics in frequency, levels and phases, as well as the intermodulation products that are created with more complex signals. Our auditory system is in fact highly non-linear: there are many mechanisms, some thoroughly studied, others not entirely clear to date, that influence perception.
This does not mean that THD is not useful for evaluating the behaviour of a device, but only that it is not designed for this purpose: a psychoacoustic model must be included, as the Rnonlin measurement does, for example.
Then there is another aspect to be taken into account, little known: the THD is not representative of all the non-linear distortions of the device on the test signal. It consider only the harmonics. In reality, a non-linear distortion (of an amount of even 10 dB higher than the "classics") is also present on the fundamental, caused by the odd orders of distortion. This is not included as it is not easy to determine. But this aspect makes the comparison between THD of devices with different "patterns" of distortion unreliable.
Speaker problems are difficult to diagnose because there are quite a few of them. Rub & buzz, torn cones, tinsel slap, punctures, delamination, demagnetization, all sort of drifts, etc. Once you put a driver in an enclosure you also may encounter, rattling, air leaks, port noise, vibration, etc.
Some of the the failure mores will result in increased THD, others will not. Some have distinctive patterns, other do not. The dominant source of THD is often also the electronics (amplifier, D/A converter, powers supply), not the speaker itself, so you need to be able to tell those apart.
And finally, you need to make sure your measurement system in is clean: i.e. microphone, pre-map, A/D converter, driver and pre-processing software etc.
So there is a lot of complexity there and lot depends on your specific application and requirements: what type of failure modes do you expect to see, how good do you need to be at detecting them and how good is your measurement hardware and software.
While complicated, it's a well studied problem and there is a lot of literature about it. There are also commercial systems that are quite good at detection most of these problems, but they tend to be "heavy duty" and not particularly cheap. Some examples are https://www.klippel.de/products/qc-system.html or https://www.listeninc.com/