Java - Finding frequency and amplitude of audio signal using FFT -
after reading no. of posts here have applied fft algorithm on recorded audio(.wav) file transform time domain frequency domain.
as result have got array containing values as
magnitude[i] = sqrt(re*re+im*im);
now title says have find frequency , amplitude of signal(complex sound i.e voice) using magnitude array, have no idea of how further processing using array.the size of fft 1024 , sample rate 48000hz. please me further processing.
if you're looking single largest (sinusoidal) component scan through magnitude array until find maximum value, , convert index of value corresponding frequency, i.e.
mag_max = magnitude[0]; i_max = 0; (i = 1; < n; ++i) { if (magnitude[i] > mag_max) { mag_max = magnitude[i]; i_max = i; } }
you have value of peak in mag_max
, index in i_max
. can frequency this:
f_max = i_max * fs / n;
where fs
sample rate (and n
fft size of course).
of course if you're looking pitch of complex sound (e.g. voice or musical instrument) things lot more complicated. might want take @ harmonic product spectrum algorithm , pitch detection algorithms in general.
Comments
Post a Comment