Pitch detection of two following music notes (C0 and C0#)
There are many ways to do pitch detection (seee e.g. https://ccrma.stanford.edu/~pdelac/154/m154paper.htm ) and which one is the most suitable depends on your application requirements and constraints. FFT isn't great if you need a lot of accuracy of accuracy (in tune, out of tune?) or good resolution at low frequencies.

You also need to be aware that for many instruments, the harmonic have higher energy than the fundamental, so the peak in the FFT isn't always the pitch.