Digital Distortion Compensation for Measurement Setup

Ahh so you use tree runs of octave at once !!

what about Arta do you also use that one on the same time but with loopback in/out ?


# octave mainListPlayrecDevs.m

give me :
Available output devices:
-1) No Device
1) HDA ATI HDMI: 0 (hw:1,3) (ALSA) 8 channels
2) E-MU 0202 | USB: Audio (hw:2,0) (ALSA) 2 channels
6) pulse (ALSA) 32 channels
10) default (ALSA) 32 channels


Available input devices:
-1) No Device
0) HDA Intel PCH: ALC269VB Analog (hw:0,0) (ALSA) 2 channels
2) E-MU 0202 | USB: Audio (hw:2,0) (ALSA) 2 channels
3) sysdefault (ALSA) 128 channels
4) samplerate (ALSA) 128 channels
5) speexrate (ALSA) 128 channels
6) pulse (ALSA) 32 channels
7) speex (ALSA) 1 channels
8) upmix (ALSA) 8 channels
9) vdownmix (ALSA) 6 channels
10) default (ALSA) 32 channels
Running playrec exitFunc...
...Terminating PortAudio.

So no problem🙂 I will make you box asap. to test.
One question why the opamp ? is it needed ? And do you use 2 x 1,5V for supply? Any improvement with 2x9V ? Opamp type ?
 
sorry forgot to load "modprobe snd-aloop"
so:
Available output devices:
-1) No Device
1) HDA ATI HDMI: 0 (hw:1,3) (ALSA) 8 channels
2) E-MU 0202 | USB: Audio (hw:2,0) (ALSA) 2 channels
3) Loopback: PCM (hw:3,0) (ALSA) 32 channels
4) Loopback: PCM (hw:3,1) (ALSA) 32 channels
8) pulse (ALSA) 32 channels
12) octave_loop (ALSA) 2 channels
13) arta_loop (ALSA) 2 channels
14) default (ALSA) 32 channels


Available input devices:
-1) No Device
0) HDA Intel PCH: ALC269VB Analog (hw:0,0) (ALSA) 2 channels
2) E-MU 0202 | USB: Audio (hw:2,0) (ALSA) 2 channels
3) Loopback: PCM (hw:3,0) (ALSA) 32 channels
4) Loopback: PCM (hw:3,1) (ALSA) 32 channels
5) sysdefault (ALSA) 128 channels
6) samplerate (ALSA) 128 channels
7) speexrate (ALSA) 128 channels
8) pulse (ALSA) 32 channels
9) speex (ALSA) 1 channels
10) upmix (ALSA) 8 channels
11) vdownmix (ALSA) 6 channels
12) octave_loop (ALSA) 2 channels
13) arta_loop (ALSA) 2 channels
14) default (ALSA) 32 channels
Running playrec exitFunc...
...Terminating PortAudio.
 
Ahh so you use tree runs of octave at once !!

Yes. Unfortunately octave does not offer multithreaded programming. It is a very rudimentary tool, but excellent in fast math prototyping.

The chain is:

Arta -> arta_loop [->] octave_loop -> mainPlay -> your soundcard playback -> DUT/calibration adapter -> your soundcard capture -> mainRec -> octave_loop [->] arta_loop -> Arta
what about Arta do you also use that one on the same time but with loopback in/out ?

Well, if you want to see what is happening, you have to run it at the same time 🙂

The tool offers a simple FFT viewer in menu - Playback/Capture -> Show FFT Chart. But Arta or another measurement FFT software is much more convenient.

One question why the opamp ? is it needed ?

It is just a real-measurement test. Plus it may be a real test - matching opamps, selecting the one with lower/more convenient distortion profile, etc
And do you use 2 x 1,5V for supply?

Those are A23 12V batteries 🙂
 
Last edited:
sorry forgot to load "modprobe snd-aloop"
so:
Available output devices:
-1) No Device
1) HDA ATI HDMI: 0 (hw:1,3) (ALSA) 8 channels
2) E-MU 0202 | USB: Audio (hw:2,0) (ALSA) 2 channels
3) Loopback: PCM (hw:3,0) (ALSA) 32 channels
4) Loopback: PCM (hw:3,1) (ALSA) 32 channels
8) pulse (ALSA) 32 channels
12) octave_loop (ALSA) 2 channels
13) arta_loop (ALSA) 2 channels
14) default (ALSA) 32 channels


Available input devices:
-1) No Device
0) HDA Intel PCH: ALC269VB Analog (hw:0,0) (ALSA) 2 channels
2) E-MU 0202 | USB: Audio (hw:2,0) (ALSA) 2 channels
3) Loopback: PCM (hw:3,0) (ALSA) 32 channels
4) Loopback: PCM (hw:3,1) (ALSA) 32 channels
5) sysdefault (ALSA) 128 channels
6) samplerate (ALSA) 128 channels
7) speexrate (ALSA) 128 channels
8) pulse (ALSA) 32 channels
9) speex (ALSA) 1 channels
10) upmix (ALSA) 8 channels
11) vdownmix (ALSA) 6 channels
12) octave_loop (ALSA) 2 channels
13) arta_loop (ALSA) 2 channels
14) default (ALSA) 32 channels
Running playrec exitFunc...
...Terminating PortAudio.

Perfect.

First test Arta -> your soundcard -> analog loopback -> your soundcard -> arta and setup your soundcard alsa controls (alsamixer -c 2) so that your EMU plays and records through required ports at required levels.

configRec.m (records from EMU, plays into octave_loop)

Code:
playRecConfig.recDeviceID = 2; % EMU
playRecConfig.playDeviceID = 12; % octave_loop

configPlay.m is the other way round (records from the loop, plays into your soundcard)

Code:
playRecConfig.recDeviceID = 12; % octave_loop
playRecConfig.playDeviceID = 2; % EMU

Also make sure these devices are disabled in pulseaudio to keep them available for you (pa config screen -> hardware -> choose emu and the loopback cards -> Off (or Disable or whatever your GUI offers).
 
Measuring a few JRC4556s, one generic RC4556 - the "measured" THDs are very low, 0.0003% - 0.00015%. NE5532P measures consistently 0.00006%, quite close to the loopback of 0.000035%. The "measured" figures are much lower than datasheet values which is quite suspicious.

But the added distortions of -130dB for a few harmonics on playback side did measure correctly in Arta (between -130 and -135dB) which would suggest the results are not so remotely incorrect.

THD+N always around 0.001%.

Surprisingly all the four tested unit-gain noniverting opamps output exactly the same level of -1.648dB. That spared calibration between measurements since one calibrated input level applied to all the measurements.

LM358N measured 0.2%, output level a bit different (by 0.05dB - quite a deal 🙂 ), IMO the chip is bad (1k load, the datasheet says 0.02% to 100k load).

I have to rebuild the adapter - the 5k wire-wound multiturn pot loads the soundcard output constantly to keep the output distortions constant. Therefore, it receives the output -0.5dB signal (1Vrms?) all the time, while the inputs switch (calibrate/measure input) is located right next to it. The grounded input (left channel) shows -100dB induced signal, the other input channel when disconnected shows also -100dB signal. This is not good for the very precise calibration, especially the LPF sampling where the LPF signal has a different phase than the VD signal induced from the pot. Everything matters when harmonics are to be compensated to < -140dB.

I will put all the key components into separate compartments of a full-metal case which itself should be shielding better than the copper tape inside the plastic box of the current adapter.

A presumably low-noise low-distortion E-MU 0404 USB is on the way, I am looking forward to comparing the results between the two soundcards.

The measurement is certainly very sensitive. The question is validity of the measured values, I have no access to professional ultra-low distortion measuring equipment.
 
Last edited:
I see, that is the old ntb you mentioned. I do not think the CPU is really up to the task, you will need 3 octave processes + arta + the system all running without xruns. I have quite bad experience with Core 2 CPUs (+ slow DDR2), they hardly keep up with modern web sites.

Is there any other machine you could use? Refurbished good brand laptops (Dell, HP, Lenovo) with i3/5 gen2/3 run at 150 EUR, with SSD/mSATA they work very nice, I use a few of them.
I will do so. I have a powerful desktop PC and access to some Intel NUCs (7i3) but for the intended application I would need an integrated portable solution, laptop based.

Meanwhile, I managed to do a basic install of Lubuntu 19.04 which works without any problem, funny enough, as I understand it it's just a slightly stripped down Ubuntu based one the same Kernel, comes with the same drivers etc. All the standard SW install mechanisms do work so I think I could easily install any packages that are needed.

Currently I still have to figure out what is the required workflow once I have the basic setup. I won't use ARTA, rather I have my own SW for generating the test signals (sines and multitones), or might use REW. Whatever it is, it will run under WINE, as will the analyzer (which might be REW as well once it has an offline feature added, in order to use the analyzer on files -- 64bit floats --rather than on the 24bit input stream). Which means the ADC output will go into a file because I will use heavy sample-synced averaging (own SW, again) to dig into the noise floor. Test signals are on exact bin center frequencies of course, prime bins actually.
Interface is the RME Adi-2 Pro FS which is top notch basically, for example it is very stable with regard to clock and reference drifts (once it's warmed up).

Basic idea of this all is to extend my current measurement capabilites which are already quite good, given the excellent interface, the block-averaging and large FFT-sizes. I can already look down into insane regions of noise and distortion but of course the intrinisic distortion of the chain "dominates everthing".... (DAC being dominant therefore notch filters don't help much and have their own problems, ADC is better).
 
Last edited:
Compare your results to the "distortion gain method" of measuring distortion on page 13 here:

http://www.ti.com/lit/ds/symlink/opa2134.pdf

Thanks for the link. They use a very different method. My "measured" distortion (I should say "identified" since the value validity is absolutely unconfirmed) are basically the same but NE5532 should be much more distorting than OPA2134. Maybe those are max figures but my particular chip works better.

Actually I have a few SMD OPA2134s but no DIL8 adapter. I really want to measure these ultra-low distortion opamps, have to wait for the adapter to arrive.
 
I would need an integrated portable solution, laptop based.

Any recent laptop will do.


Meanwhile, I managed to do a basic install of Lubuntu 19.04

19.04 is a beta with short-term support. You may want to use the 18.04 LTS release with 5+ years of support. Time flies fast 🙂

I won't use ARTA

Any software using alsa will do. Wine + windows software (Arta, Visual Analyzer Visual Analyser details ), java (i.e. REW, jaaa), any software compiled directly for linux.
 
What I meant was to use the distortion gain method with the opamps you just tested to compare the results as away to confirm them.

I do not have the AP they used 🙂 Honestly, I do not want to build a whole rig for this. I hope one day me or someone else will have a chance to measure with APx500 or RTX6001 or some Rhode Schwartz, or a simple yet low-noise notch filter with amp. I still have quite some work on this project ahead 🙂
 
19.04 is a beta with short-term support. You may want to use the 18.04 LTS release with 5+ years of support. Time flies fast 🙂
Once i have a suitable laptop I'll use Ubuntu 18.04 LTS to make sure to have the same system platform that you are using. For this, your idea of making available a complete image of your actual system with everything in place already would be highly appreciated.

As for checking results, I could offer cross-testing with both my RME and my old AP SYS2322 (a boat anchor, highly non-portable, and not SOTA anymore), using the noise-gain method. For this, I would make a simple amp with a gain of -1, using a 5534 with switchable noise gain resistor, in shielded case + a suitable supply, that I would send to you after testing, together with the setup specifics (levels, frequency)
 
I do not have the AP they used 🙂 Honestly, I do not want to build a whole rig for this. I hope one day me or someone else will have a chance to measure with APx500 or RTX6001 or some Rhode Schwartz, or a simple yet low-noise notch filter with amp. I still have quite some work on this project ahead 🙂

Can't you just insert the distortion gain resistor into the opamp circuit and measure again to see if the harmonic profile is the same and is magnified by the predicted amount?
 
I do not have the AP they used 🙂 Honestly, I do not want to build a whole rig for this. I hope one day me or someone else will have a chance to measure with APx500 or RTX6001 or some Rhode Schwartz, or a simple yet low-noise notch filter with amp. I still have quite some work on this project ahead 🙂

I think he means that by using the method to increase the noise gain while keeping the signal gain constant, you artificially increase the circuit's distortion. It is done by putting a small value resistor between the two opamp inputs. It is a way to accurately measure the distortion of very low distortion opamps with equipment that has less resolution.

With the given values the circuit distortion is increased 40dB, so you measure and then correct the result by 40dB.
It's explained in Samuel Groner's article, he used it to measure to -180dB.

It is not about the test equipment, there's no test rig involved, just a single resistor

Low-Distortion, Low-Noise Composite Operational Amplifier - Semantic Scholar

Jan
 
Last edited:
Guys, thanks a lot for persevering. Honestly, I did not study the details, saw AP mentioned and put it aside..

You are right the method is actually very simple. I would use feedback resistor R2 1k, no R1 (i.e. unit gain), error-amplification resistor R3 20R - that should amplify the distortion by about 50x. Can I keep the 1k load resistor?
 
For this, your idea of making available a complete image of your actual system with everything in place already would be highly appreciated.

OK, I will prepare the image. I will take me about a week, the family directs me for the Alps today plus have to clean-up my testing installation first.

Thanks a lot for your great offer of the pre-measured amp. I will try the noise-gain method with my rig, we will see if the results make sense and if further testing should follow.
 
I think he means that by using the method to increase the noise gain while keeping the signal gain constant, you artificially increase the circuit's distortion. It is done by putting a small value resistor between the two opamp inputs. It is a way to accurately measure the distortion of very low distortion opamps with equipment that has less resolution.

With the given values the circuit distortion is increased 40dB, so you measure and then correct the result by 40dB.
It's explained in Samuel Groner's article, he used it to measure to -180dB.

I have also tried this method, up to 60dB noise gain.

I hope that the phofman's method does not try to eliminate/cancel any harmonic frequencies it finds. The comparison of the 2 methods might be interesting.