• Welcome to ASR. There are many reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

Using Cross Corelation to lower influence of ADC for DAC measurements

Thank you very much! I did some first experiments yesterday and all seems to work fine, although the exact channel routing appeared to be a bit obscured. Also, it seems that stereo .WAV import is not implemented yet (may follow, though?) -- but I can work around that atm, using ADI-2 Pro in digital loopback, to test with reproducible known signals to get a feel for this new (to me) technique.
OK , thank WAV is not implemented.
I think i discover "loopback" parameter ,
I try this afternoon
 
I did some test at my silly rig and the noise is indeed 10dB down:

NoCC.png

No CC


CC.png

CC

E-MU 0204 I/O /64k FFT/ Blackman-Harris7/ 96kHz/ 87.5% overlap and only 8 averages

I didn't try various windows as I wanted to see what it does relative to what I did before.
I also didn't try to get my reference noise level which is -113dB at the poor rig as what I wanted to see is the difference changing on the fly.
I suppose a lot of optimization can be done.

Edit:Here's with the intended 1k averages:

1kav.PNG
 
Last edited:
I also did a silly try using the virtual balanced input option and got this:

Cur.PNG

Whooping -144dB

Edit: with 1k CC :

237dB.PNG

-237db
 
Last edited:
OK, finally simple enough for me to understand. :)

Yes, that works. Here it is on that Apollo Solo again for 1000 cross correlations with a synthetic 1 kHz tone injected with the appropriate polarity on each input, with some H2 and H3 to confirm they survive the processing. There isn't a lot of common mode pickup on those open inputs but enough to show it works.

View attachment 385158
This is post #133.
As far as I understood it compares:
a) Inverting one of the inputs electrically and inverting the acquired data again in software prior to cross-correlation
to
b) Cross-correlation of two channels with normal polarity.

@FrenchFan: I haven't yet taken the effort to crawl through the math, but this result puzzles me.

With one of the channels inverted:
- I do expect an improvement for everything that has to do with polarity dependent imperfections of the DAC (-> the errors of the 2 channels do not correlate and get reduced).
- I do not expect, that a common-mode signal gets reduced by the cross-correlation. My understanding is: The common-mode signal is still correlated - just with the sign flipped / a phase of 180 deg.

Edit: If this holds true, e.g. a 2nd harmonic caused by the ADC with 180deg phase compared to the other input channel would as well be removed.

What are your thoughts regarding this?

Edit: Of course everyone is welcome to help me resolve what appears a contradiction to me.
 
Last edited:
This is post #133.
As far as I understood it compares:
a) Inverting one of the inputs electrically and inverting the acquired data again in software prior to cross-correlation
to
b) Cross-correlation of two channels with normal polarity.

@FrenchFan: I haven't yet taken the effort to crawl through the math, but this result puzzles me.

With one of the channels inverted:
- I do expect an improvement for everything that has to do with polarity dependent imperfections of the DAC (-> the errors of the 2 channels do not correlate and get reduced).
- I do not expect, that a common-mode signal gets reduced by the cross-correlation. My understanding is: The common-mode signal is still correlated - just with the sign flipped / a phase of 180 deg.

Edit: If this holds true, e.g. a 2nd harmonic caused by the ADC with 180deg phase compared to the other input channel would as well be removed.

What are your thoughts regarding this?

Edit: Of course everyone is welcome to help me resolve what appears a contradiction to me.
I ruturn i few minutes i Put result in line about D50III ,
I compare REW with my DIY script
 
Hello all

I put here the comparison between my script and REW
concerning the measurement of my DAC TOPPING D50III

I think the test is transformed.

John there are 2 points:

1) You do not accumulate the curves in your home page.

2) It would be better to have the correlation
on a *.wav file, it would go faster after
recording.

Try only with 131072 samples and you will understand.
Moreover as soon as the correlation is finished it is lost we
can not go back on it, on recording it is easier.

But there, it is you who judge the behavior.

PS:

Do not look at the THD, John told me that my software
was rotten, and that I must start again.
It heated my ears. :facepalm:
 

Attachments

  • REW_Correl_D50II_2.png
    REW_Correl_D50II_2.png
    460.6 KB · Views: 103
  • REW_No_Correl_D50II_2.png
    REW_No_Correl_D50II_2.png
    434.9 KB · Views: 110
I ruturn i few minutes i Put result in line about D50III ,
I compare REW with my DIY script
No hurry, I'm on vacation the next 2 weeks and thus have not the possibility to play with John's new version.
I'm really curious (thanks a lot for your immediate effort, John !), but vacation is not too bad either ;-)
 
This is post #133.
As far as I understood it compares:
a) Inverting one of the inputs electrically and inverting the acquired data again in software prior to cross-correlation
to
b) Cross-correlation of two channels with normal polarity.

@FrenchFan: I haven't yet taken the effort to crawl through the math, but this result puzzles me.

With one of the channels inverted:
- I do expect an improvement for everything that has to do with polarity dependent imperfections of the DAC (-> the errors of the 2 channels do not correlate and get reduced).
- I do not expect, that a common-mode signal gets reduced by the cross-correlation. My understanding is: The common-mode signal is still correlated - just with the sign flipped / a phase of 180 deg.

Edit: If this holds true, e.g. a 2nd harmonic caused by the ADC with 180deg phase compared to the other input channel would as well be removed.

What are your thoughts regarding this?

Edit: Of course everyone is welcome to help me resolve what appears a contradiction to me.
nanook

The answer is "No".

If one channel has a harmonic line and the other
channel has the same line phase-shifted by 180°, you will find
this line at the correlation output.

There is a correlation.

This comes from the correlation in time, I take
the equation again, and also tell you to go see the doc of
"Zurich Industrie" that I put at the beginning, there are
small drawings that explain how the correlation is done.

It is exactly like the convolution with the time of a
function, reversed.

Correlation or convolution, the understanding is identical.
CrossCorrelInTIme.png

What the equation of the correlation function shows
The first signal = s(teta)
the 2nd signal = r*(teta-to)

You do an integral in d(teta).
so for each point "to" you will have a correlation value
that corresponds to the integral at "to" given.

You move "to" and you start again.

So on you will arrive at having a function of "to"
therefore the correlation function.

This time shift is neither more nor less than a phase shift.

look at this link there is an animated gif on the
correlation of 2 sines.


This correlation function by the Fourier transform
is transformed into FFT1*conj(FFT2).

In fact we do the Fourier transform of the correlation function in time, in our denoiser.

With the FFT the time function is still there so we see that
to make it we slide the signals in phase, so the phase
information is lost, but your signal is there.

I explained above the analog correlator which is neither more nor less than the correlation integral put into electronics.

multiplier + integrator, you can resume the reasoning with
and you will fall back on your feet.

What I said in my first email, to understand correlation and
convolution you need a small piece of paper, a pencil and put your head
in your hands.

I had done this at school and I remember well that it was hard.
 
Hello all

I put here the comparison between my script and REW
concerning the measurement of my DAC TOPPING D50III

I think the test is transformed.

John there are 2 points:

1) You do not accumulate the curves in your home page.

2) It would be better to have the correlation
on a *.wav file, it would go faster after
recording.

Try only with 131072 samples and you will understand.
Moreover as soon as the correlation is finished it is lost we
can not go back on it, on recording it is easier.

But there, it is you who judge the behavior.

PS:

Do not look at the THD, John told me that my software
was rotten, and that I must start again.
It heated my ears. :facepalm:

I'm getting a much greater reduction in noise level. 1000 averages. I'll give the beta REW a try to see what it reports for the same setup... Interesting to see the 60Hz line so obvious with cross-correlation while completely obscured by standard averages (blue):

1723388058553.png
 
I'm getting a much greater reduction in noise level. 1000 averages. I'll give the beta REW a try to see what it reports for the same setup... Interesting to see the 60Hz line so obvious with cross-correlation while completely obscured by standard averages (blue):

View attachment 385944
What seems strange to me is the variance of your
correlated noise.
The correlation in addition to reducing the noise, greatly smooths the
curve.
Look at the curves in REW and in my interface the
noise has a small variation in amplitude.

What is your parameters
E1DA adc calibre
record attenuation
E1DA scaler gain if you have
D5OIII gain , 0db -1db -2db .... etc
OUT voltage : 4V or 5V
 
Last edited:
What seems strange to me is the variance of your
correlated noise.
The correlation in addition to reducing the noise, greatly smooths the
curve.
Look at the curves in REW and in my interface the
noise has a small variation in amplitude.

What is your parameters
E1DA adc calibre
record attenuation
E1DA scaler gain if you have
D5OIII gain , 0db -1db -2db .... etc
OUT voltage : 4V or 5V

Maybe we’re not doing the same calculation. A vector average of cross-correlated values for each FFT bin doesn’t reduce variations/swings in the correlated noise, only in the uncorrelated noise. That said, I think my result was with a 128k FFT, so that may explain the visual difference.
 
With one of the channels inverted:
- I do expect an improvement for everything that has to do with polarity dependent imperfections of the DAC (-> the errors of the 2 channels do not correlate and get reduced).
- I do not expect, that a common-mode signal gets reduced by the cross-correlation. My understanding is: The common-mode signal is still correlated - just with the sign flipped / a phase of 180 deg.
The process is correlation and summing of the real parts of the correlation results. Only summed values > 0 are accepted for the final result.

You do not accumulate the curves in your home page
You can save any RTA result as a measurement by clicking this button:

1723393373074.png


It would be better to have the correlation
on a *.wav file, it would go faster after
recording
Not faster than doing it directly instead of recording it, though :)
 
Only if the implementation is poor. THD calculations should not rely on single bin amplitudes. The energy in the fundamental and harmonics is distributed across bins according to their frequency and the spreading span of the window, but energy is not lost regardless of the window choice.

V5.40 beta 49 is now available with the cross correlation feature.
There is a problem

your noise for 10 correlation is not clean

I think that removing the imaginary parts
from the calculation of the correlation was not a good plan.
 

Attachments

  • REW_10_Correlation.png
    REW_10_Correlation.png
    324.7 KB · Views: 104
  • DIYtool_10correlation.png
    DIYtool_10correlation.png
    42.9 KB · Views: 86
The process is correlation and summing of the real parts of the correlation results. Only summed values > 0 are accepted for the final result.


You can save any RTA result as a measurement by clicking this button:

View attachment 385947


Not faster than doing it directly instead of recording it, though :)
The process is correlation and summing of the real parts of the correlation results. Only summed values > 0 are accepted for the final result.


You can save any RTA result as a measurement by clicking this button:

View attachment 385947


Not faster than doing it directly instead of recording it, though :)
YES, I don't display the curves when I calculate
it's much faster :p

the rest OK

About calculation speed with the wav it's possible use multithreading .
It exactly what we need , independente calculus ,If I could I would have done it
For me octave have un big BUG with this .
 
Last edited:
your noise for 10 correlation is not clean

I think that removing the imaginary parts
from the calculation of the correlation was not a good plan.
Your "Cross correlation bible" paper disagrees with you.
 
It doesn't matter how fast you calculate, you still need the time to capture the recording so it can't be faster than doing the calculation while recording.
True, but we may want to keep in mind that someone may want to apply CC averaging on existing (or preprocessed, or synthesized) data, and that's were a file import would be handy. It use it all the time with the other averaging options and enjoy the maxed out computation speed even with max overlap.
I understand one would probably need a modified import dialog, switching from the current "L", "R" and "Both" option to a single "Stereo" entry that is selected automatically when CC is engaged (and gives an error if it is not a 2-channel .WAV).
 
Last edited:
There is a problem

your noise for 10 correlation is not clean
That is something I stumbled upon as well. And I certainly prefer the cleaner plot of your implementation.
Lacking deeper background knowledge, I cannot say which one is technically more correct but certainly your clean plot example is much nicer to the eye.
 
The process is correlation and summing of the real parts of the correlation results. Only summed values > 0 are accepted for the final result.
Thanks, @JohnPM , I think now I got it. And thanks @KSTR for a short offline discussion.

1) Cc without inverting one input:
Everything that shows up as a difference in the digitized data of the two ADC channels must have been added by the ADCs and can (and if the maximum noise reduction is the aim - should) be ignored.
The downside is the somewhat disrupted spectrum due to the substitution of negative values with "0" when plotted in log-scale.

2) Cc with inverting one channel (swap pins 2,3):
"Payload" signal components are processed just like in 1) - apart from polarity related differences of the ADCs - due to the 2nd inversion in software prior to the correlation.
Interference (like hum through Gnd-loop and noise introduced by noisy supplies in the ADC), will show up with just one inversion (SW) leading to negative values which are ignored when only values > 0 are accepted for the final result.

This is my current understanding why the 50 Hz line was suppressed for the 2x inverting case in the plot shown in post #133.
 
Your "Cross correlation bible" paper disagrees with you.
I don't agree

Look at the noise with 10 correl,
you've already seen blocks of flat noise at -237db.

Your calculation is messed up.

The noise I have at 10 correl is approximately
that of one of the averaged noises.

Even with 10 correl you should see approximately
the signal's PSD.

Anyway, at the calculation level I applied
the formula strictly, so I can't be wrong
about that.


________________________________________________

I confirm this is crazy

Look at the measurement of 183 correl at quantasylum, there is
no noise that comes close to 240db.
 

Attachments

  • Correl_noise.png
    Correl_noise.png
    199.4 KB · Views: 70
  • Correl_noise_2.png
    Correl_noise_2.png
    36.4 KB · Views: 78
  • Correl_184_QuantaSylum.png
    Correl_184_QuantaSylum.png
    101.6 KB · Views: 67
  • Correl_184.png
    Correl_184.png
    216.2 KB · Views: 68
Last edited:
Back
Top Bottom