What I am trying to achieve is getting the fundamental frequency of a note played by an instrument. What I have already done is performing an FFT on a samples of audio file, and here's what I get:
After that I just tried to find the maximum value in that dataset and I get "4138". Unfortunately, the note being played in the audio file is an E and from internet I know that the E note should have 5274.04 Hz or 2637.02 Hz.
I continued reading some additional info on the internet and found interesting info that in some cases fundamental frequencies could be missing from the sound, so I have tried doing some autocorrelation on the samples I got from the audio file to find the fundamental frequency and I got something like this:
It looked like a frequency domain for me so I performed FFT on that dataset but got similar results.
Also I have read that some people suggest using HPS (Harmonic Product Spectrum) for finding the fundamental frequency, I have tried that but obviously the result was the same, as the FFT itself didn't change.
P.S. Of course I use Hamming windowing function for samples. The library I use for FFT is JTransforms.