user3544831
user3544831

Reputation: 11

Finding Peak frequency in AudioRecord Android

I need to identify the prek frequency contineously. I've tried FFT and JTransform
But i didn't get correct frequency and it has lots of noise. I don't know how to rectify that.I've searched on google, unfortunately i didn't find proper one.
So if you have any other working example determining peak frequency.

Please share with us,

Thank you.

Upvotes: 1

Views: 820

Answers (1)

Babson
Babson

Reputation: 949

I'm still not sure what your input signal is, or how you know that you're getting the wrong peak frequencies from your Fourier analysis and/or from your peak detector.

In general, to test your FFT you'll want a synthetic pure tone, such as this 32 Hz cosine tone.

Synthetic 32 Hz cosine tone - Sooeet.com FFT calculator

When you process this pure tone with your FFT you should get a single peak at 32 Hz like this:

FFT spectrum of synthetic 32 Hz cosine tone - Sooeet.com FFT calculator

To test your peak detection code, you'll want to attenuate your 32 Hz tone to say half power, and add another full power pure tone at say 64 Hz, like this:

Synthetic 32 Hz and 64 Hz cosine tones - Sooeet.com FFT calculator

When you process these two harmonics with the FFT you should get two peaks at 32 and 64 Hz, and the 32 Hz peak should be at half power relative to the 64 Hz peak.

FFT spectrum of synthetic 32 Hz and 64 Hz cosine tones - Sooeet.com FFT calculator

After your code is working fine with the above synthetic signals, you should try a real known signal such as this single E2 note being plucked on an acoustic guitar:

Guitar E2 note - Sooeet.com FFT calculator

The FFT spectrum of this E2 note signal looks like this:

FFT spectrum of guitar E2 note - Sooeet.com FFT calculator

With this real signal, your peak power detector should find the 161 Hz peak, which for this signal happens to be the first harmonic of the E2 note. The lower-power peak at 80 Hz is the true fundamental frequency of the E2 note.

Synthetic signals and real signals can be generated with the Sooeet FFT calculator

Upvotes: 1

Related Questions