Low-distortion Audio-range Oscillator

Notch filter compensation

Jan, to push the envelope can you connect a soundcard to the notch monitor out from the AP and use Diana to look at just the harmonics? Edmund has a routine for correcting for the insertion loss of the notch. Diana can separate the harmonics and even reconstruct the phase accurate error.
But I'm still busy with this: DiAna, a software Distortion Analyzer
The problem is how to calculate or estimate the insertion loss at the fundamental by means of interpolation. Perhaps B-splines again?

Cheers, E.
 
Last edited:
Edmond: in my distortion compensation project I tried estimating the RC filter component values by nonlinear regression (curve-fitting) of the respective circuit equations to the measured transfer values (amplitude and phase shift), initialized with imprecise values of the circuit components. Worked very precisely. Once the circuit model has the exact component values determined by curve-fitting, you can probe it for any parameter at any condition.

In your case the equations would be more complicated since the filter is a bit more complex, but you could offer a few typical circuits + user would enter the nominal component values. Good libraries can curve-fit complex values which makes the equations much simplier.

The equation for RC LPF was trivial with complex numbers nonlinear-compensation/lowPass.m at 078fb9f1c572568f343bb0bd652b2ea55874896d * pavhofman/nonlinear-compensation * GitHub

Finding exact values of R1, C1, Rin to fit the measured transfer values (in my trial just randomized exact values) were only several lines nonlinear-compensation/testLP.m at 078fb9f1c572568f343bb0bd652b2ea55874896d * pavhofman/nonlinear-compensation * GitHub

The core of my algorithm is based on nonlinear curve-fitting and the fitting precision is extremely good (sum of squared errors at 1e-20), of course provided the equations are correct.

I am sure it would work, especially if you let some software derive the equations for you.

Maybe some interpolation will work too, but definitely not as accurately as the circuit model fitted to measured values. On the other hand you do not need any major precision in your interpolation, it does not matter if diana measures values with a few percent of relative error.

Just 2 cents.
 
Latest version of my THD calculator

Latest version of my THD calculator. What's new?
- Import possibility from ARTA
- Selection of harmonics
 

Attachments

  • THDcalculator.zip
    690.8 KB · Views: 47
  • thdc_arta.png
    thdc_arta.png
    92.5 KB · Views: 367
AX tech editor
Joined 2002
Paid Member
Ralf, I'm trying to figure out the calculations.

For H2, the measurement (I think) is -94.6dB. The notch atten for H2 is -8.8dB. So the actual H2 is then -85.8dB, right?
The amp gain is 40.1dB. That gives me -125.9dB. But the calculated column says -124dB. Maybe I miss something, but I can't solve it.
How do you do it?

Edit: if I figure in the atten from 600R Zout and 2.5k Zin I get the missing 1.8dB. But that would be for both the (notched) fundamental as well as the harmonics, so should make no difference. I think ...

Jan
 
Last edited:
Ralf, I'm trying to figure out the calculations.

For H2, the measurement (I think) is -94.6dB. The notch atten for H2 is -8.8dB. So the actual H2 is then -85.8dB, right?
The amp gain is 40.1dB. That gives me -125.9dB. But the calculated column says -124dB. Maybe I miss something, but I can't solve it.
How do you do it?

Edit: if I figure in the atten from 600R Zout and 2.5k Zin I get the missing 1.8dB. But that would be for both the (notched) fundamental as well as the harmonics, so should make no difference. I think ...

Jan


Your conclusions are correct. The value of the attenuated fundamental doesn't matter in the calculation. I do the calulation with the unattenuated input fundamental. This has the advantage that I don't need to know the fundamental attenuation of the notch filter. In addition, if the oscillator frequency deviates from the notch frequency, then the attenuation is different again.
 
AX tech editor
Joined 2002
Paid Member
Your conclusions are correct. The value of the attenuated fundamental doesn't matter in the calculation. I do the calulation with the unattenuated input fundamental. This has the advantage that I don't need to know the fundamental attenuation of the notch filter. In addition, if the oscillator frequency deviates from the notch frequency, then the attenuation is different again.

But my point was that you have to (and I think you do) take into account the attenuation from DUT Zout and notch Zin, the 600R - 2.5k. Right? It is a fixed factor in your test setup.

Jan
 
AX tech editor
Joined 2002
Paid Member
I'll do that tomorrow. I understand the concept.

Jan

I tried to characterize the AP notch filter but it doesn't seem to work. Probably some interference from what the AP thinks it should do.

I set the AP to fixed 1kHz notch, set DiAna to 1kHz too. Edmond, the waveform I see in characterisation mode, is that the ref channel or the test channel? It shows a rather distorted wave, 20% THD, looks like strong xover.

The output of the notch on the scope looks like the usual noise with little signal detectable, which is to be expected.

Jan
 
Edmond: in my distortion compensation project I tried estimating the RC filter component values by nonlinear regression (curve-fitting) of the respective circuit equations to the measured transfer values (amplitude and phase shift), initialized with imprecise values of the circuit components. Worked very precisely. Once the circuit model has the exact component values determined by curve-fitting, you can probe it for any parameter at any condition............
This would be a very nice and elegant solution. As a matter of fact, I was already thinking in that direction, but that means a project on its own right, because a lot of math is involved (and I don't have a library that takes most of the work off my hands). For the time being and out of curiosity, I will first try 3rd degree B-splines (simply because I'm familiar with it) followed up by a rational function interpolation. The latter is most likely more appropriate because poles are involved.
Edmund, could you enter the fundamental attenuation manually? What I did was plot the attenuation curve for harmonic correction and adjust for the loss/gain in the Shibasoku output which is fixed.
Yes it can. After an analysis you can select the option "Reference" (see pic), in which case the amplitude of the fundamental is substituted by the Output level as specified in the Distortion menu. Now the harmonic amplitudes are referred to this level. That's what you want, right?

Cheers, E.
 

Attachments

  • reference.png
    reference.png
    2.1 KB · Views: 390
Another option is measuring the transfer of the filter at the required frequencies directly by diana, using a simple switchable adapter. Since the code already talks to the soundcard, no major complication.

Transfer parameters of the filter vary only very little, for this purpose the calibration would hold valid for months.
 
Latest version of my THD calculator. What's new?
- Import possibility from ARTA
- Selection of harmonics

I tried your calculator. The chain was:

Gen - Viktor1k, output 1.9Vrms, +5.5dBv
Notch - passive twin-t notch 1k
Preamp - OPA827 +40dB
Analyzer - XFi USB HD modded
 

Attachments

  • Viktor1k-Notch1k-OPA827_40dB.png
    Viktor1k-Notch1k-OPA827_40dB.png
    50.1 KB · Views: 371
  • Viktor1k-Notch1k-40dB-XFi-cal.png
    Viktor1k-Notch1k-40dB-XFi-cal.png
    119.7 KB · Views: 381
Member
Joined 2004
Paid Member
I remember when I first got the Shibasoku and wanted to confirm the harmonics. I had to create an essentially phase locked harmonic tone at a precise level and mix with the Victor oscillator to verify the harmonic accuracy. Complicated to do but essential to verify accuracy. It was possible to see the effect of the phase causing cancellation of harmonics. However this is an essential step when looking so deep. Verifying harmonic level and confirming they aren't cancelling is important. Its a key piece of Pavel's efforts.
 
I tried your calculator. The chain was:

Gen - Viktor1k, output 1.9Vrms, +5.5dBv
Notch - passive twin-t notch 1k
Preamp - OPA827 +40dB
Analyzer - XFi USB HD modded


I suspect a measurement error / misunderstanding here. Can you connect the oscillator directly to the ADC and adjust the level so that it has about 0dBFS and then insert the DUT + notch and not adjust the level. And set the level also to 0dBFS @ calculator.


Moreover I suspect you are using the notch circuit from Victor. Has it really an input impedance of about 5100 ohms @H2?
 
Last edited:
I suspect a measurement error / misunderstanding here. Can you connect the oscillator directly to the ADC and adjust the level so that it has about 0dBFS and then insert the DUT + notch and not adjust the level. And set the level also to 0dBFS @ calculator.

Moreover I suspect you are using the notch circuit from Victor. Has it really an input impedance of about 5100 ohms @H2?

there is no DUT, DUT is a generator itself
analyzer 0dBFS = 0.5Vrms, -6dBV
notch H1 imp cc 5k
notch H2 imp cc 4k
notch H3 imp cc 3k5

The calculation is correct, let's see

From analyzer, [dBV]:
H1 -10
H2 -112
H3 -115

Amplified by 40dB, after correction [dBV]:
H1 -50
H2 -152
H3 -155

Notch attenaution [dB]
H1 -55
H2 -9
H3 -5

After correction, generator level [dBV]
H1 +5
H2 -143
H3 -150

Distortion in dBc
H2 -148
H3 -155
 
Member
Joined 2009
Paid Member
there is no DUT, DUT is a generator itself
analyzer 0dBFS = 0.5Vrms, -6dBV
notch H1 imp cc 5k
notch H2 imp cc 4k
notch H3 imp cc 3k5

The calculation is correct, let's see

From analyzer, [dBV]:
H1 -10
H2 -112
H3 -115

Amplified by 40dB, after correction [dBV]:
H1 -50
H2 -152
H3 -155

Notch attenaution [dB]
H1 -55
H2 -9
H3 -5

After correction, generator level [dBV]
H1 +5
H2 -143
H3 -150

Distortion in dBc
H2 -148
H3 -155

I actually think the calculation is more simple than that.....

Using the same numbers:

No notch:
H1 = -6dBV

Harmonics measured with notch:
H2 = -112 after 40 dB amplification
H3 = -115 after 40 dB amplification

Notch attenuation measured using H2 and H3 test signals:
H2att = -9 dBV
H3att = -5 dBV

Harmonics corrected for notch attenuation and amplification:
H2 = -112 + 9 - 40 = -143 dBV
H3 = -115 + 5 - 40 = -150 dBV

Relative to fundamental:
H2 = -143 + 6 = -137 dBc
H3 = -150 + 6 = -144 dBc

I can see that the result is different and that worries me, even though I can't see where I'm doing something wrong:confused:

As pointed out by diyralf the attenuation of the fundamental should be kept out of the equation as it is unreliable to quantify it accurately and irrelevant as long as it is big enough not to interfere with the quantification of the harmonics.

As long as the depth of the notch @ H2 and H3 are actually measured in the same circuit, and not table values, I also cannot see why we should correct for input impedance of the notch as this is already included.