示例#1
0
        private void SetupCoeffs()
        {
            var window = WWWindowFunc.BlackmanWindow(WindowLength);

            // ループ処理を簡単にするため最初と最後に0を置く。
            mCoeffs = new double[1 + WindowLength + 1];
            int center = WindowLength / 2;

            for (int i = 0; i < WindowLength / 2 + 1; ++i)
            {
                int numerator         = i;
                int denominator       = Factor;
                int numeratorReminder = numerator % (denominator * 2);
                if (numerator == 0)
                {
                    mCoeffs[1 + center + i] = 1.0f;
                }
                else if (numerator % denominator == 0)
                {
                    // sinc(180 deg) == 0, sinc(360 deg) == 0, ...
                    mCoeffs[1 + center + i] = 0.0f;
                }
                else
                {
                    mCoeffs[1 + center + i] = Math.Sin(Math.PI * numeratorReminder / denominator)
                                              / (Math.PI * numerator / denominator)
                                              * window[center + i];
                }
                mCoeffs[1 + center - i] = mCoeffs[1 + center + i];
            }
        }
示例#2
0
 public OverlappedFft(int fftLength)
 {
     mFftLength             = fftLength;
     mFft                   = new WWRadix2Fft(mFftLength);
     mOverlapInputSamples   = new double[mFftLength / 2];
     mWindow                = WWWindowFunc.BlackmanWindow(mFftLength / 2 - 1);
     mLastOutputSamplesTail = new double[mFftLength / mSpliceDenominator];
     mFirstTime             = true;
 }