0
votes

After reading a no. of posts here itself i have applied an FFT algorithm on the recorded audio(.wav) file to transform it from time domain to frequency domain.

As a result i have got an array containing some values as

magnitude[i] = sqrt(re*re+im*im);

Now as the title says i have to find frequency and amplitude of the signal(complex sound i.e voice) using this magnitude array, but i have no idea of how to do further processing using this array.The size of FFT is 1024 and sample rate is 48000Hz. Please help me for further processing.

1

1 Answers

0
votes

If you're just looking for the single largest (sinusoidal) component then scan through the magnitude array until you find the maximum value, and then convert the index of this value to its corresponding frequency, i.e.

mag_max = magnitude[0];
i_max = 0;
for (i = 1; i < N; ++i)
{
    if (magnitude[i] > mag_max)
    {
        mag_max = magnitude[i];
        i_max = i;
    }
}

You now have the value of the peak in mag_max and its index in i_max. You can get the frequency like this:

f_max = i_max * Fs / N;

where Fs is the sample rate (and N is the FFT size of course).

Of course if you're looking for something like the pitch of a complex sound (e.g. a voice or a musical instrument) then things get a lot more complicated. You might want to take a look at the Harmonic Product Spectrum algorithm and pitch detection algorithms in general.