最近在搞声音录制的问题,怪自己大学学的差, 真是书到用时方很少阿
应用FFT变换时一点头绪也没有了,我在CSDN上也查到了一些函数如
Void ComplexFFT(complex <double> * Time_data, complex<double>* Freq_data, 
Int num)
{

}
小弟才疏学浅, 不知这个函数到底得到什么, 大概只明白参数中一个是时域数组, 一个是频域数组, 但是我想得到频域的某个频率的波形的幅度,或是总共这个输入波形由哪几种波形构成, 到底该对这个时域数组处理才能得到我想要的东西哪?多谢指教, 小弟分不多, 谁棒我解决, 分我都给他 

解决方案 »

  1.   

    http://www.codeproject.com/cpp/howtofft.asp
    http://www.codeproject.com/audio/waveInFFT.asp
      

  2.   

    这两个例子我已经看了, 就是对其中变换后的结果处理不是很懂,希望哪位给我解释一下, 比如我想得到基频的频率, 以及噪声功率所占的百分比, 等等这些应该怎样变缓呢?也就是说怎样对结果处理呢?//代码片段
    finright[FFT_LEN/2],
    fout[FFT_LEN],
    foutimg[FFT_LEN],
    fdraw[FFT_LEN/2]; DWORD nCount = 0;
    for (DWORD dw = 0; dw < FFT_LEN; dw++)
    {
    //copy audio signal to fft real component for left channel
    finleft[nCount] = (double)((short*)pwh->lpData)[dw++];
    //copy audio signal to fft real component for right channel
    finright[nCount++] = (double)((short*)pwh->lpData)[dw];
    } //Perform FFT on left channel
    fft_double(FFT_LEN/2,0,finleft,NULL,fout,foutimg);
    float re,im,fmax=-99999.9f,fmin=99999.9f;
    for(int i=1;i < FFT_LEN/4;i++)//Use FFT_LEN/4 since the data is mirrored within the array.
    {
    re = fout[i];
    im = foutimg[i];
    //get amplitude and scale to 0..256 range
    fdraw[i]=AmplitudeScaled(re,im,FFT_LEN/2,256);
    if (fdraw[i] > fmax)
    {
    fmax = fdraw[i];
    }
    if (fdraw[i] < fmin)
    {
    fmin = fdraw[i];
    }
    } //Use this to send the average band amplitude to something
    int nAvg, nBars=16, nCur = 0;
    for(int j=1;j < FFT_LEN/4;j++)
    {
    nAvg = 0;
    for (int n=0; n < nBars; n++)
    {
    nAvg += (int)fdraw[j];
    }
    nAvg /= nBars;
    //Send data here to something,
    //nothing to send it to so we print it.
    TRACE("Average for Bar#%d is %d\n",nCur++,nAvg);
    j+=nBars-1;
    }#define mag_sqrd(re,im) (re*re+im*im)
    #define Decibels(re,im) ((re == 0 && im == 0) ? (0) : 10.0*log10(double(mag_sqrd(re,im))))
    #define Amplitude(re,im,len) (GetFrequencyIntensity(re,im)/(len))
    #define AmplitudeScaled(re,im,len,scale) ((int)Amplitude(re,im,len)%scale)上述代码就是从里子Copy来得, 他定义了4个宏, 分别是用来得到什么的呢?
    小弟把大学的东西实在是忘的一干二净, 麻烦帮我解释一下.
    谢谢