I am new in DSP, trying to calculate fundamental frequency ( f(0)
) for each segmented frame of the audio file. The methods of F0 estimation can be divided into three categories:
- based on temporal dynamics of the signal time-domain;
- based on the frequency structure frequency-domain, and
- hybrid methods.
Most of the examples are estimating fundamental frequency based on the frequency structure frequency-domain, I am looking for based on temporal dynamics of the signal time-domain.
This article provides some information but I am still not clear how to calculate it in the time domain?
https://gist.github.com/endolith/255291This is the code, I have found, used so far :
def freq_from_autocorr(sig, fs):
"""
Estimate frequency using autocorrelation
"""
# Calculate autocorrelation and throw away the negative lags
corr = correlate(sig, sig, mode='full')
corr = corr[len(corr)//2:]
# Find the first low point
d = diff(corr)
start = nonzero(d > 0)[0][0]
# Find the next peak after the low point (other than 0 lag). This bit is
# not reliable for long signals, due to the desired peak occurring between
# samples, and other peaks appearing higher.
# Should use a weighting function to de-emphasize the peaks at longer lags.
peak = argmax(corr[start:]) + start
px, py = parabolic(corr, peak)
return fs / px
How to estimate in time domain?
Thanks in advance!