About measurement of distortion rate


We summarized restrictions and cautions in measuring distortion ratio (THD, THD + N) by combining WaveSpectra (WS), sister software WaveGene (WG) and external oscillator.

(If you are in a hurry skip the explanation and see summary)


WS, I think that if you measure the distortion factor very normally, it will be almost as follows.
(1) THD is measured to be smaller than the original value.
(2) For THD + N, it is measured to be larger than the original value.


There are two possible causes of these measurement errors.
The influence of the window function and the frequency resolution at the time of FFT.

I will examine it with the signal created by WG.
* Because Wave file created by WG is calculated directly with WS as input signal, performance of the sound device itself is irrelevant even when playing with a sound device at that time.
(This is not the case when measuring by inputting an external signal to the sound device.)


(1) THD case

We will create the following two Wave files at 48000 Hz, 16 bit which is common with WG. (Wave file length is appropriate)
The first one is
Wave 1: 1000 Hz sine wave, -3 dB
Wave 2: 2000 Hz sine wave, -63 dB
Mixed.
And the second one is
Wave 1: 1000 Hz sine wave, -3 dB
Wave 3: 3000 Hz sine wave, -63 dB
Mixed.
Two are the second harmonic and the distortion factor having only the third harmonic, respectively It should be a 0.1% 1 kHz signal.

We will look at the distortion ratio (THD) by playing the created signal with WS.
￿￿ Set WS to measurement mode and press the THD, RMS button Leave it on.
(Also, the number of FFT sample data of WS is set in the setting dialog I will keep it at 4096)

THD is the upper numerical value of the display part of THD, + N.

Table 1

Window function

1 kHz + 2 kHz

1 kHz + 3 kHz

Hanning

Blackman
-Harris

Flat top

None (Rectangle)

You can see that there are differences depending on the window function. (Especially it is supposed to be terrible though window function without rectangle window (rectangular window))
Furthermore, we can see that there is also a difference between 1 kHz + 2 kHz and 1 kHz + 3 kHz.

Measurement of THD of WS is quite common, the ratio of the component of the fundamental wave (the largest component when not specifying otherwise) and the component of the integer multiples of the frequency to obtain the ratio of the RMS value We are displaying.

Except in the case of a rectangular window which will calculate many distortion components different from original due to the influence of the frequency response of the window function, 1 kHz At + 2 kHz, both values ??are around 0.08%, the original value It is less than 0.1%.
At 1 kHz + 3 kHz it is even smaller, but of course the original value is It is 0.1%.

However, the result close to the original value is obtained in the Flat top window.

In addition to the influence of the window function, these are more fundamental for the following reasons.

The dB value of the maximum value Max in each figure (excluding the Flat top window) It is not -3 dB, and it is subtly different depending on the window function and the frequency is As you can imagine since it is 996.1 Hz instead of 1000 Hz, the frequency resolution in FFT is affected.

In the above case, since it is 48000 Hz sampling and 4096 point FFT, the frequency resolution is It becomes 48000/4096 = 11.71875 Hz.
Therefore, when 1000 Hz signal counts direct current as 0 th, 85 th The frequency component of 11.71875 * 85 = 996.09375 Hz is the maximum value.
(The next 86 th 1007.8125 Hz is also close to 1000 Hz, but 996.09375 Hz Is closer to 1000 Hz, the 85th is the maximum value)

In other words, it means that frequency components in the low part separated from the original 1000 Hz by about 4 Hz are being displayed, and considering that the value of the frequency component is the amount passed through the band pass filter having the width corresponding to the resolution, each of the upper You can also see that the dB value of Max in the figure depends on the window function.
(Negative) error due to the difference in shape of the frequency response near the center of the window function has come out.

Further, for the harmonic component, 996.09375 Hz By collecting the components at integral multiples of, we can see that the (negative) error further increases.

For example,
At twice the 2000 Hz, 85 * the second 11.71875 * 170 = 1992.1875 Hz (deviation of about 8 Hz)
Three times 3000 Hz, 85 * Third 11.71875 * 255 = 2988.28125 Hz (deviation of about 12 Hz)
As a matter of course, the deviation from 2000 Hz and 3000 Hz gradually expands as higher harmonics.

In other words, THD is measured to be smaller than the original value will be.
(For this reason it is measured lower than the original value as far as higher harmonics are available.)

By the way, in the case above, twice the ingredients, in fact 85 * 171, not 170th, 2003. 90625 Hz It becomes maximum with 3 times the ingredients of 85 * 3 Just 3000 Hz at 256th instead of 255 It becomes maximum with.
In other words, the center that becomes maximum deviates from the integral multiple of the fundamental wave.

In the meantime, the frequency response near the center is flat Flat top windows reduce the drop, but in order to obtain accurate values ??it is easiest to measure in combination with WG as follows.


From the above, conversely, if the measurement frequency matches an integer multiple of the resolution of the FFT (centered), it can be measured accurately.
In other words, from the beginning it is only necessary to measure at a frequency that matches an integer multiple of the resolution.
In other words, the sample length of the FFT is exactly equal to the integral multiple of the period of the measurement signal.
In this case, the waveforms are connected at the beginning and the end of the cutout part, and no matter where you cut it, the error for that part disappears.
(It is the case that the best result is obtained when there is no window function (rectangular window))

With

WG, create a wave file as follows.
For these reasons, WG makes it easy to set the frequency Function to make it an integral multiple of the resolution of FFT, "Optimized for FFT" I use this because it has a function. (Please see the help of WG for details)
The first one is
Wave 1: 996.09375 Hz sine wave, -3 dB
Wave 2: 1992.1875 Hz sine wave, -63 dB
Mixed.
The second one is
Wave 1: 996.09375 Hz sine wave, -3 dB
Wave 3: 2988.28125 Hz sine wave, -63 dB
Mixed.
As for the first two, the distortion rate having only the second harmonic and the third harmonic respectively It should be a 0.1% 1 kHz signal.

￿￿ Wave 1: 996.09375 Hz The sine wave is first Wave 1 Set the frequency setting combo box of 1000 to 1000, right click on the mouse on it, and select "Optimize for FFT" (F) " If you select, it will be converted automatically.
Always, right click "FFT sample number (T)" in the same way " I chose 4096 by. (Match the FFT length in WS)

* Wave 2: 1992.1875 Hz The sine wave is obtained by right-clicking the mouse on the frequency setting combo box of Wave 2 and selecting "Wave 1 multiples (W)" & If you select "" x 2 "", it will be converted automatically.

* Wave 3: 2988.28125 Hz The sine wave is obtained by right-clicking the mouse on the frequency setting combo box of Wave 3 and setting "Wave 1 multiples (W)" & If you select " x 3 & quot ;, it will be converted automatically.

Since these are not automatically linked, Wave 1 When changing the frequency of Wave 2 and 3, it is necessary to repeat the setting of Wave 2 and 3 again.

Play back the created signal with WS and look at the distortion factor.

Table 2

Window function

996.09375 Hz + 1992.1875 kHz

996.09375 Hz + 2988.28125 Hz

Hanning

Blackman
-Harris

Flat top

None (Rectangle)

Now you can see that it is the correct value.
(This time "Optimized for FFT", the sample length of FFT is exactly equal to the integral multiple of the period of the measurement signal, so there is no influence of data clipping and originally Correct measurement will be done when " No window function " ￿￿ only one spectrum of each component becomes)


Let's also look at when the fundamental frequency is lower.
It is similarly examined for the case of 100 Hz.

Table 3

Window function

100 Hz + 200 Hz

100 Hz + 300 Hz

Hanning

Blackman
-Harris

Flat top

None (Rectangle)

You can see that the difference by the window function is larger than at 1 kHz.
It seems that results close to the original value are obtained in the Flat top window.


We will also look at the case of optimizing " FFT & quot ;.

Table 4

Window function

100 Hz + 200 Hz

100 Hz + 300 Hz

Hanning

Blackman
-Harris

Flat top

None (Rectangle)

You can see that it is correct value.


(2) In the case of THD + N

In the case of

THD + N it should be more easily understood that the window function has a big influence.

First of all, please see the figure below.


Although this is a spectrum of 1 kHz 0 dB signal when hanning window is applied (4096 points FFT as before), you can see that the base of the window function is expanding.

In determining THD + N from now on, the fundamental wave can take only one frequency component at the position of the maximum value, but it is not a matter of how much from where to collect as a part other than the noise component, that is, the fundamental wave It will be understood that it becomes.
If you include all of the footings, you can imagine that it will naturally be much larger than originally. (It is true.)
This is because it is an apparent component of the cut-out portion of the FFT sample and the window function, which is not present in the signal itself.

For the sake of clarity, in the figure above it is not the display of THD + N Since it is displayed by S / N, it is good if it is about 96 dB.
As you can see, it is around 95 dB and it is nearly the correct value, so it might seem like that, on the contrary.
However, this is because it is excluded so as not to include a part (both sides) of the base part close to the fundamental wave as a noise component so as to be almost correct.
(How much range to exclude is adjusted by experiments)

Try to make the same signal extend more base When it is displayed with 2048 point FFT, it becomes as follows, it is about 88 dB and it is also increasing, and it is understood that the influence of the window function has come out. (It can not be ruled out because the foot spreads more, you can see that it also spreads to 2 kHz.)



If it is set to the number of samples of 4096 points or more, there is not much difference in influence due to exclusion.

By the way, it is not 1000 Hz, and "Optimized for FFT" " It is 996.09375 Hz, and it is imagined that good results will be obtained if we eliminate the influence of the foot of the window function, but that is the figure below.
As you can imagine it is about 96 dB. (4096 point FFT Hanning window)



Next, when we return to THD + N and pay attention to the harmonic component (and noise) when using the window function, similarly, since there is a broadening of the base by the window function for each harmonic If you collect all the noise as it is, it becomes larger than the original value for the same reason as above.
As for harmonics, since excluding near the center is not done like the fundamental wave, the components of all the skirts are added and it becomes a large value.

In Table 2 of (1), THD + N is larger than THD for the same reason.
Only one, each spectrum does not spread at the base with only one spectrum In the case of " no window function & quot ;, both are almost the same You will see that it is 0.1% correct value.

So, if THD + N, it will be measured larger than the original value .
(Furthermore, the greater the value of the distortion component, the more the number of such distortions, the greater the increase due to the footsteps will be found)

Finally confirm with sine wave + noise signal.

With the WG, create a wave file as follows.
Wave 1: 1000 Hz sine wave, -3 dB
Wave 2: White noise, -55.1 dB
With this, it should be a signal of approximately 0.1% when measured with THD + N.

(As shown below, looking at the FFT of the two components separately, the ratio of RMS values 60 dB, that is, THD + N becomes 0.1%)

1000 Hz -3 dB only (RMS value -6.01 dB)

White noise only (RMS value-66.01 dB)


For further comparison, optimize 1000 Hz to "FFT" " It added the signal of 996.09375 Hz -3 dB and added THD + N I tried to measure.

THD + N is the number below the display of THD, + N.

Table 5

Window function

1 kHz + white noise (-60 dB)

996.09375 Hz + white noise (-60 dB)

Hanning

Blackman
-Harris

Flat top

None (Rectangle)

* In a general case where the measurement frequency is not optimized for "FFT" in general, none of the original THD + N is greater than 0.1%. (Hanning window has the smallest error?)

* Optimizing the measurement frequency to " FFT & quot ;, there is no difference that it is larger than the original value, but everything is improved and errors are reduced.

In this case, in fact, if you do not have a window function you should be able to do the correct measurement, but about 0.096% It is smaller than the original value of 0.1%.
This is because, as explained a little above, a part of the vicinity of the fundamental wave is excluded from the noise component, so the noise component is reduced by that much.
In the case of "without optimization" for FFT, when there is no window function, since there is no origin at the base (spectrum is only one), it is excluded although it is not necessary to exclude it.
In the future, we may not exclude this in case of no window function.
(In the case of no window function, optimize measurement frequency "FFT" " Only the measured frequency is synchronized with the window and other noise components are not synchronized, so there should be an error for cutting out with a rectangular window. However, in the general case where the noise component is not so large, it is considered to be of no particular problem.)


(3) Number of FFT sample data

I summarized the difference depending on the number of FFT sample data.

As before, when the fundamental frequency is 1 kHz, there is almost no difference as follows.
The window function is a Hanning window. THD 0.1% is the correct value.

Table 6

Number of samples

1kHz + 2kHz

1kHz + 3kHz

4096

16384

65536


However, caution is necessary as the basic frequency will be different if it is lower.
Below is the same as for the case of 100 Hz.
You can see that harmonics can not be separated unless the number of sample data is increased.
However, even if you increase it, you can also see that THD's value is not that right for reason (1). (THD 0.1% is the correct value)

Table 7

Number of samples

100 Hz + 200 Hz

100 Hz + 300 Hz

4096

16384

65536


When optimized " to FFT, 4096 points are correct.

Table 8

Number of samples

105.46875 Hz + 210.9375 Hz

105.46875 Hz + 316.40625 Hz

4096

16384

65536



Summary

I summarized what you think is better to watch out for distortion measurement in WS.

  1. Pay attention to the measurement frequency setting.

    Specifically, it is preferable to use WG as a signal source instead of an external oscillator as much as possible, adjust the frequency of the measurement signal to the FFT sample data length of WS on the WG side Optimize " FFT " so that the frequency matches an integer multiple of the resolution of the FFT.
    This will reduce the measurement error.

  2. Also note the window function used.

    In the case of only THD, it is optimized for "FFT" as in 1. " If you do, it will not change very much with any window function, but originally No window function (rectangular window) should be good.
    In the case of not optimizing " FFT " (when it can not be optimized, such as when using an external oscillator) It is better to use the Flat top window.
    Also, it seems better to use the Flat top window even when the fundamental frequency is low.

    In the case of THD + N, similarly " Optimized for FFT " Hanning window or no window function (rectangular window).
    Note that in the case of Hanning window, there are slightly more eyes, and in the case of no window function (rectangular window), it becomes slightly smaller eye value at present.

  3. Also note the number of FFT sample data.

    Optimized for " FFT " does not affect much, but it is optimized for " FFT " If it is not done (when it can not be optimized, such as when using an external oscillator, etc.), make the data length so that second harmonic can be reliably separated.
    If you do too much indefinitely, the error will increase for reason (1).

  4. Sound devices that operate WG and WS use objects that can record and reproduce simultaneously (full duplex operation is possible).

    When using a separate sound device, such as when using another PC dedicated to playback / recording, the clocks of the two parties are not perfectly synchronized, so 1 Even if you optimize " " to FFT it can not be measured accurately.
    (Even if it is a crystal oscillator, even if there is a slight difference in such an application.)
    When you try it you understand, but the width of the spectrum will fluctuate.)

  5. Check the distortion characteristics of the sound device itself thoroughly with your own loop connection etc. in advance.

    Naturally, the measurement accuracy depends on the performance of the sound device to be used.
    Since the measurement result becomes the distortion and noise of the device itself, please understand beforehand what type of distortion and noise characteristics the device is.

    Depending on the device, be careful as there is a need to restrict the input to -2 to 3 dB, suddenly distorting when inputting near 0 dB. (Such as part of sound blaster card)

Created with the Personal Edition of HelpNDoc: Free CHM Help documentation generator