Published on September 10, 2019

Copyright © **Dan P. Bullard**

In several earlier articles I talked about some of the advantages of what I call the Bullard method of measuring Signal to Noise Ratio, Total Harmonic Distortion (even though THD is a lie) and related measurements like ENOB, etc. The secret of this new method is the fact that if you can coax the captured wave into a cosine wave (which really isn't that hard) you can get better, more reliable results in these measurements than using the old ASS U ME method where you make and ASS out of U and ME by assuming that the harmonics reside only in the first 4 or 6 or 8 harmonic candidates. There is no proof that harmonics end after any randomly selected number. In many cases, the harmonics can persist way up into the spectrum, and may even rise up out of the noise floor after apparently going to zero.

In the above spectrum you can see a non color-coded set of distortion products, harmonics all, with zero noise added to the wave. Below is a look at the wave in time domain.

Zero crossing distortion does a heck of a good job generating a lot of harmonics that persist high into the spectrum. That's because of the sudden sharp edge as the transistor on one side of a push-pull pair shuts off suddenly. Now, in real life it may not be that sudden, but zero crossing distortion does create a lot of harmonics high into the spectrum. Some of them even alias if you are not sampling fast enough. But you don't really need to worry about aliasing if you know how to implement Dan's Rules. However, wouldn't it be nice not to have to calculate where the aliases are going to land? Wouldn't it be nice to not even care where the fundamental bin is? Sure would be nice for a generic THD and SNR test would it not? But how can you do that? Just look for the maximum amplitude in the spectrum, then look at the phases of every bin in the entire spectrum relative to that maximum bin's phase. As I showed you before, it's easy to shift the wave to be a cosine wave, so that the harmonics obey Daver's Law which says that:

Once you know the "M" of the fundamental, it's easy to figure out which bins the harmonics are in, and then you can fine tune the phases, if needed to make sure you capture every one of them and exclude the noise, which is not phase related to the fundamental.

Now, I distorted this cosine wave and just did a brainless look at the spectrum to see if I could find the aliases as well as the unaliased harmonics. I made the actual M really high, 67 in this case, which pushes everything above the 15th harmonic into aliasing territory. And here is what I got.

Here I calculate the 9 harmonic THD (since I know that the fundamental is in the 67th bin), -43.88dB and I ignore everything above the 9th. That is the traditional way of doing THD, but it's severely flawed because as we can see at the top of this article, harmonics don't stop after the 9th, or 20th, or even the 51st harmonic. In addition, this method assumes that anything that is not in the first 9 harmonics is noise, seriously corrupting the SNR value. Again, there is no noise in this wave, but everything that is not counted as a harmonic is considered noise, and so the SNR value comes out to 37.85dB despite there not being a single bit of noise in this wave.

Now, use the Bullard method by determining which bins contain harmonics by looking at the phase of each spectral bin. As you can see down the left side of this table, every single bin contains a harmonic (since we know for a fact there is no noise) and so the value Dan's THD comes out to -36.88dB, a full 7dB difference, which, in case you forgot is a factor of two in real terms. That's because **all** the harmonics created by the distortion are found and counted. But what's far more important is that Dan's SNR reads 200dB and that is because the Bullard method could not find a single speck of noise in the entire spectrum. Because there isn't any! If I added noise, then you would see some, but it's not there.

Now you might be saying, hey, wait a minute, what happened to the phases of the aliasing harmonics? That's a good question (and an interview question at LTXC). They flipped by 180 degrees, so anything that was at 0 degrees becomes 180 degrees, and anything that is 180 degrees becomes 0 degrees. Well, that was mighty convenient! In fact, the phase reverses every time the harmonic bounces off either the Nyquist frequency or the DC bin, so the phases keep getting reversed, but that's OK because what we are looking for is either 0 or 180 degrees since we are using a cosine wave.

Think about what you could do with this new technique! You don't even have to know what frequency the fundamental is, and if you are clever, you can work out which bins contain the harmonics are in order to coerce the wave into a pure cosine wave. Anything is possible once you have knowledge.