# Implementing an offline guitar monophonic pitch detector

I am implementing an offline guitar monophonic pitch detector. I was wondering about the trade-off of the standard methods: Autocorrelation, HPS, Cepstrum, picking the peak from an STFT, the YIN algorithm.

I am working with audio that could will be segmented according to onset times, but let's assume this is done, so let's assume that I am given 5 segments which have been correctly segmented (start at the onset time, finish a frames afterwards).

My first question is: How long should a be? I guess that for algorithms like Autocorrelation, the bigger the segment the better?

Also, when working with guitar in particular, is there any issue I should take care of and is one of those methods preferable? I would assume HPS is good as the guitar produces a lot of harmonics.

I tried implementing Autocorrelation but I get a lot of octave errors. Would the YIN algorithm correct many of those? I also implemented a simple peak picking from an STFT but I often get strongest harmonics instead of the perceived pitch.