Cannot read correct frequency for AudioBuffer

Reliable pitch tracking is not an easy task.
Do you need help about the coding part or the algorithm part?
For the algorithm part there are some threads about it already on the forum.