0

I know I'm definitely not the first to ask about using FFT to find frequencies with Android's AudioRecord, but after reading tons of forums, I'm still not understanding it too well.

I ended up using the class ComplexDoubleFFT, part of the Herschel Common Science System and code similar to here.

AudioRecord recorder = new AudioRecord(MediaRecorder.AudioSource.MIC, rate, channelConfig, audioFormat, bufferSize);

...

double[] micBufferData = new double[audioData.length];
      int x=0;
      for(short data : audioData)
      {
          micBufferData[x] = data;
          x++;
      }


      FFT newFFT = new FFT(bufferSize/2);
      newFFT.ft(micBufferData);

The next thing to do is basically the same thing that is done in the thread I already mentioned above as it worked for them. However, they have an array named toTransform and I am not for sure where they got it from. I'm assuming that is their list of FFT values, but I have no clue how to even get the values! I've gone through the class files for the ComplexDoubleFFT and there is nowhere where it even returns its output. Hopefully the way I worded all of this isn't confusing. Any help is much appreciated!

Community
  • 1
  • 1
Sp4mm4ge
  • 23
  • 3

1 Answers1

0

I figured it out. The function ft in the ComplexDoubleFFT class changes the array you pass it dynamically. If anyone else needs help with doing this (or just help using an FFT in Android in general) leave a message on here and I will elaborate more.

Sp4mm4ge
  • 23
  • 3