3

I’m trying to do an application, where user will say something and then click a button which will give them the frequency value for what they said. I have been searching a lot , and I have concluded that ,I need to use firstly audio record class, to record the voice, and then use FFT to convert it to frequency. My main question is that FFT gives a frequency graph, and I don’t need that, I need the frequency and pitch value. how can i do that?

Please help me :)

Nutan
  • 513
  • 2
  • 10
  • 16

2 Answers2

3

Unless you are collecting a pure-pitch sound (like a sine wave), your results will actually be a range of frequencies which you are getting at the moment with the FFT (check out this description).

The pitch of a sound can be gathered from the FFT graph by using pitch-estimation algorithms (see answer here). Here's some links to open-source pitch tracking implementations if that would suit.

It's definitely doable!

Good luck.

Community
  • 1
  • 1
CodeMonkey
  • 1,426
  • 1
  • 14
  • 32
  • Can you provide me example of getting pitch value using pitch estimation algorithm please . – Nutan Jul 30 '13 at 07:07
  • Hey Nutan, not really sorry. There is a good example [here](http://stackoverflow.com/questions/9979196/find-voice-pitch-on-android) for processing the FFT values, and a map of frequency-to-pitch [here](http://www.codeproject.com/Articles/32172/FFT-Guitar-Tuner). Really wish I could be more help. – CodeMonkey Jul 30 '13 at 07:29
0

There are a lot of things you can use to help with this process. JTransforms is a library that lets you take FFT easily. You need to take FFT at multiple points to the get the respective frequency at each of those points. When I say "point", I mean that you should break the audio up into blocks that will be FFT'd individually. These blocks can overlap for improved accuracy. They can also be windowed before the FFT is performed for more accuracy.

Then, the results of the FFT need to be manipulated more to make the result more accurate. This can be done using Cepstrum analysis or Harmonic Product Spectrum analysis, and other ways.

Lastly, keep in mind there are other solutions besides FFT. The autocorrelation method does not uses the frequency domain at all. It checks the actual audio file samples to determine frequency. This can be more computationally expensive, but it can also be more accurate.

ritmatter
  • 3,448
  • 4
  • 24
  • 43