Speech Recognition Fast Fourier (FFT) implementation (a supplement)

In front of the actual formula is called the discrete Fourier transform (DFT), its initial implementation as follows (Baidu to one that awoke me, it is very simple, met):

             int N = inputArr.GetLength (0); // input voice waveform byte [] array, in the vertical section 128 shock (0,255)
            Double the PI = 3.1415926;
            double [] = Real new new double [N]; // real
            double [ ] imag = new double [N] ; // imaginary
            Double [] = new new Double resultN [N];
            byte [] = new new byte X [N];
            byte [] = histN new new byte [N];

            IF (inputArr = null!)
            {
                X = inputArr;
            }
            the else return;
            for (int K = 0; K <N; K ++)
            {
                for (int n-= 0; n-<N; n-++)
                {
                    Real [K] = Real [k] + (x [n ] - 128) * Math.Cos (2 * PI * k * n / N); // 128 associated with the amplitude
                    imag [k] = imag [k ] - (x [n] - 128) Math.Sin * (2 * n-the PI * K * / N);

                }
                resultN [K] = Math.Sqrt (Real [K] Real * [K] + imag [K] * imag [K]); / / is very simple, a dual circulation will be achieved.
                histN [k] = (byte) (255 - resultN [k] / 10); // calculated here associated with the display
            }

(To be continued, slowly ...........) a little small change every day ☺

发布了66 篇原创文章 · 获赞 12 · 访问量 1万+

Guess you like

Origin blog.csdn.net/ganggangwawa/article/details/93487861