# YIN pitch estimation algoritm-simplified explanation [closed]

can someone please explain the steps of YIN pitch detection algorithm in a simple way "especially the last 3 steps".

here is the research paper of YIN algorithm http://audition.ens.fr/adc/pdf/2002_JASA_YIN.pdf Thanks in advance

Edit1(as i understand): I understand the autocorrelation to find out if the signal periodic or not "step1", then we will take the difference between the original signal with zero lag"delay" and subtract it with a delayed one "step2",now we have the negative peaks but to make the algorithm works and pick up the first delayed negative peak with the lowest delay we have to remove the first negative peak with 0 delay"step3", the fourth step is to set a threshold to get the most negative peak(i am not sure if i am right)"step4",step 5 & step 6 i dont understand them,can you please tell me if i am explaining right or wrong

• Hi! I'm afraid this question is a little too broad. Can you narrow down a bit for us what specifically you don't understand? Since that paper lists six steps, saying "I don't understand the last three" means "I don't understand the better half of the method", and, well, that's not specific enough to actually be answered... Commented Sep 9, 2018 at 17:35
• I understand the autocorrelation to find out if the signal periodic or not "step1", then we will take the difference between the original signal with zero lag"delay" and subtract it with a delayed one "step2",now we have the negative peaks but to make the algorithm works and pick up the first delayed negative peak with the lowest delay we have to remove the first negative peak with 0 delay"step3", the fourth step is to set a threshold to get the most negative peak(i am not sure if i am right)"step4",step 5 & step 6 i dont understand them,can you please tell me if i am explaining right or wrong Commented Sep 9, 2018 at 17:52
• and explain to me the last two steps...thank you for your response sir Commented Sep 9, 2018 at 17:52
• @MarcusMüller done Commented Sep 9, 2018 at 22:23

There is an older question about YIN where I am expressing lack of impressing. The only thing that is novel in YIN is the Cumulative mean normalized difference function (Step 3):

what is plotted above is the Average Squared Difference Function (ASDF) which is similar to the older AMDF. the purpose of this Cumulative mean normalized difference function is to normalize the result (for the purpose of a threshold), and to do something to avoid picking the null at a lag of 0 samples from being picked as the lag for the best match. they could have just said they won't start searching for the lag with the lowest null (or the null they want for the purpose of measuring the period) after the first lag that has a sign change for the slope. that would be the first peak, and then they can start searching for the lowest null without worrying about picking the null at zero.

i'm not impressed with YIN. i think i have a better idea for avoiding picking the wrong peak.

here's another one.

think of the Autocorrelation function as an upside-down ASDF. so then you're looking for peaks instead of valleys.

UPDATE:

as per request, Step 5, parabolic interpolation of peaks (or valleys) is discussed in this answer and the Julius Smith reference therein. it is for getting sub-sample precision from the ACF evaluated at discrete lags.

step 6 is about avoiding picking the wrong peak and avoiding indecisively switching back-and-forth between candidate peaks. this is usually what we call "the Octave Problem". i discuss it in this answer. the YIN paper one identifies the problem and does not satisfactorally deal with it.

• thank you sir for your clear explanation, is possible to talk alittle bit more about step 5 and 6? Commented Sep 10, 2018 at 12:32