Reputation: 255
I am trying to find fundamental frequency with YIN algorithm in python.
I am at step 2 of this document.
I need to find index of 0 value from this code:
def auto(t, lag, samples):
total_index = len(samples)
zero_padded = np.append(samples, np.zeros(total_index))
r = 0
for j in range(t+1, t+total_index):
r += zero_padded[j] * zero_padded[j+lag]
return r
diff = []
rt0 = auto(0, 0, samples)
for lag in range(0, 2700):
diff.append(rt0 + auto(lag, 0, samples) - (2*auto(0, lag, samples)))
as mentioned in document:
but I cannot find any 0 value index except index(lag) = 0.
and the document said they did cumulative mean to nomalize.
Upvotes: 2
Views: 1035
Reputation: 70663
Typically, one ignores the AMDF result with a lag at or near zero, and looks for a non-zero AMDF lag with a small but usually non-zero difference. Which non-zero AMDF to select is known as the octave problem, and may involve weighting the difference function.
Upvotes: 2