I've been trying for some time now to find the best solution to calculate the fundamental frequency of a sample captured using AudioRecord in real-time.
I have looked around some examples around here on SO: This one, and this one are the questions that helped me the most, but I still did not understand fully how they would work for finding the fundamental frequency. So what I am looking for is a more detailed explanation of what do I need to do to find the fundamental frequency having a sample.
So, I create an AudioRecord:
micData = new AudioRecord(audioSource, sampleRate, channel, encoding, bufferSize);
data = new short[bufferSize];
And start listening:
micData.startRecording();
sample = micData.read(data,0,bufferSize);
And I understand how to create a Complex array, but I don't know exactly which methods out of FFT.java I can use the values of to create these complex numbers and the which one would be the method that returns the peak frequency.