Multitone distortion measurement

I’m interested in a measurement that gives me the energy of the signal minus the energy of the stimulus. This would represent the total Distortion+Noise. (Because when you subtract the stimulus you are left with distortion and noise).

Klippel has a good description of it here: Multi-tone Distortion

I was hoping either N+D or SNR measurements would do that, but it doesn’t look like it.

Is there a way to do this without messing with the API? If I have to use the API and write my own code, what is the easiest way to do that?

Use the residual visualizer?

Residual visualizer won’t help me because it only works for a single frequency.
I’m looking for a measurement that gives me a single number that sums noise and distortion, for a multi-tone stimulus.

Hi @Siarez, this seems a good idea. Is this done elsewhere? And if so, what is the measurement called? I agree it’s very hard to make sense of a multitone (other than a visual check), but summing all the noise between the tones could have merit and make for an easy comparison as long as the number of carriers were the same.

Hi @matt,
The link to the Klippel website (in my first post) presents how it works in their product and why it is a useful measurement. This figure is specially helpful.


That page also has good references.

Does residual only work for one frequency then? The value wanted is the same as the rms residual, if that’s helpful?

Hi @MarkT,
You are right that the RMS of the residual would do the trick, but unfortunately according to the Wiki it only works for a single frequency, so it won’t work for multitone.

On the QA40x analyzer, the Residual visualizer applies an deep IIR filter notch to the incoming signal. The center frequency of the notch is determined by the generator 1 setting.

If I am right the risidual display works in the time domain and it is done by passing the data to a notch filter for a single frequency.

Would this work in the frequency domain:

  • Use that API to get the fft.
  • Remove the multitone bins from the fft.
  • Calculate the THD+N from what’s left of the fft?

I guess after that you could use an inverse fft to transform back to the time domain again and display it as a risidual.

Hi @breedj, Yes what you suggest should work. I was hoping that there was a way to do this without messing with the API :upside_down_face:

I think it makes a lot of sense to update the software so the built-in N+D and/or SNR measurements work with the multitone stimulus.

Hi @Siarez, got it, thanks! There’s already a N+D tile. I wonder if when in multitone mode if that just reports the RMS of the red area in your drawing? Or should be the measurement be named somehting like MT N+D? Or perhaps a visualizer that shows a bar height for first order energy, second order, third order. Or maybe just a visualizer that shows RMS of tones and RMS of everything else…

Hi @matt ,
I’m sure the N+D tile is not showing the RMS of the red area. It’s value is way off in my loopback test.
A “MT N+D” tile makes sense, but if the behaviour of the N+D title was changed to show the correct value, that would work too.

Or maybe just a visualizer that shows RMS of tones and RMS of everything else…

This would work too :slight_smile:

@matt I just saw the PyQa40x repo. I had no clue it existed. I’m pretty good at Python, so gave it a go and it works like a charm!
I now can implement the measurement above with a degree of customization that I thought wouldn’t be possible any straightforward way.

I’m surprised this repo isn’t advertised more. It is an absolute game changer for how I’ll be using the QA403. More people should know about it.

Hi @siarez, I’m glad it’s helpful to you! As you put some more miles/km on it, I’d be interested in hearing your thoughts on how the library feels overall.