python - YIN algorithm to find fundamental frequency -
i try find fundamental frequency several algorithms.
i found yin algorithm(http://audition.ens.fr/adc/pdf/2002_jasa_yin.pdf)
i follow steps , write code.
the autocorrelation function document is:
and expected graph :
so sample code is:
def auto(lag, samples): window_size = 1100 total_index = len(samples) zero_padded = np.append(samples, np.zeros(window_size)) corr = [] t in range(total_index): r = 0 j in range(t+1, t+window_size): r += zero_padded[j] * zero_padded[j+lag] corr.append(r) plt.plot(corr) plt.show()
how should edit code?
Comments
Post a Comment