Electrical – Autocorrelation: zero crossing

signalsignal processing

I am trying to calculate the fundamental frequency (pitch) from autocorrelation method. Below is the figure of the signal I have.enter image description here

The autocorrelation that I calculated by the following code in python is given in the picture below:

        N = len(kiri) #here kiri is the input signal shown in the above pic
        nlags=N/2
        r = np.zeros(nlags) #
        m=np.zeros(nlags)
        for lag in range(nlags):
            for nl in range(N - lag):
                r[lag] += kiri[nl] * kiri[nl + lag]

autocorrelation output

Now what I want to know is that, is the autocorrelation supposed to have zero crossings in all cases of input signals? if yes, then does that mean the abouve autocorrelation result is wrong ?

When I try to use the above autocorrelation results to calculate pitch using Mcleod Pitch Method, the NSDF function does not have zero crossings hence unable to calculate pitch. (link for reference of this method is in the comments)

Is this autocorrelation calculation method correct ? Or since the input signal itself is not exactly a periodic signal, the autocorrelation won't have zero crossings ?

Please help.

Best Answer

Yes, the autocorrelation is can have zero crossings. A negative autocorrelation value means that the two signals are anti-correlated, ie that they have similar magnitude, but opposite sign.

If you want to find the pitch, I would recommend reading "Spectral Analysis of Signals", by Petre Soica and Randolph Moses, it reviews the most common methods and their properties.