I write my own scripts with octave

to better understand audio analysis

and it is not a luxury to delve

into the equations to help understand.

I saw by chance that QuantaSylum offered

measurement noise reduction by cross correlation.

look at the beginning of the following blog:

@Matt, a couple questions. Is there any way to mono the inputs to reduce noise as in the Cosmos ADC? Can we get the equivalent of the AES17-2015 Notch that REW uses?

forum.quantasylum.com

So I looked for how to realize the function.

I still leave my sources here.

Ultra-sensitive voltage measurements are a crucial requirement for applications such as quantum device characterization [1]. Weak signals become easily obscured by thermal noise, especially that coming from the measurement apparatus...

www.zhinst.com

Concerning the theory the calculation for me is simple,

I have the points of the FFT and I can therefore easily

do the calculation indicated in the paper of "Zurich instrument".

FFTcorr=FFT1.*conj(FFT2); # correl FFT1 FFT2

FFT1 = FFT of one channel

FFT2 = FFT of the other channel

conj=FFT complex conjugate

I can do the cumulation and the average then,

each FFT includes a block of N samples.

If you do an analysis with 32K samples, each correl

will take 32K samples,

I let you understand the deep theory of measurement.

time T to F

Corr(g,h) <=> G( f )H* ( f )

g,h time signal

G,H FFT of each signal

The cumulation allows to add the correlated signals (frequency line)

is to add the noises in quadratic value, noise = sqrt(noise1^2+noise2^2)

The final average gives directly the FFT with the noise reduction.

But well it is not easy to understand the convolution or correlation,

you need your little paper and make the signals and rack your brains.

If we look at the paper from "Zurich instrument" the noise reduction is

approximately log(NB correlations)*5.

so 10 correlation = -5db

100 = -10db

1000 = -15db

etc ....

Well be careful it is only when the signals are very close in terms of noise to the ADC floor.

A test with a signal at 1000Hz and another signal at 1000Hz + 2000Hz.

In a single correlation you lower the 2000Hz signal by 100db

To reduce the recording time I tested the overlap of the measurement blocks,

it is viable up to 90% overlap, we can reduce the measurement time

by 10 for the same number of correlations.

I will leave here the octave FFT calculation scripts with weighting window,

THD+N calculation and calculation function and launch of the correlation.

I am sure that this will help some and decide some to write their own script.

I assure you, I thought I knew everything about FFT and signal processing

and well I was wrong, while writing the software

I realized that I did not know much.

Hey, who can explain to me seriously, with proof, why the noise floor in an FFT

at a given sampling frequency increases when the number of samples decreases.

Bye and good luck .

----------------------------------------------------------------------------------------------------

Using scripts :

You will certainly need to install octave , I'll let you do it .

You will need to load the signal package , if you are on linux

octave and packages are in your repository .

If you are on windows or mac , I don't know , I only use Linux .

package are under "forge"

clculFFTmain.m :

contains FFT calculation + weighting window + THD+N calculation + display procedure

correl_FFT_optmized.m :

contains correlation calculation and result display

and THD+N calculation

nbCalcul = nb correlation

coeffShift = shift , 1 overlap = 0% , 0.1 overlap = 90%

replace the wav files with yours .

the 2 "S2_x_noise.wav" are used for calculation

The comments are in French, I think you will easily

translate them.

Be careful, I write software like a dog, so be careful.