Example #1
0
        public void CalculateCoefficients(FFT.Algorithm algorithm, FFT.FilterType filter)
        {
            // Generate the actual coefficients
            this.CurrentAlgorithm = algorithm;
            this.CurrentFilter    = filter;
            if (algorithm == FFT.Algorithm.Kaiser)
            {
                // For kaiser window function we need to set the attentuation
                this.StopBandAttenuation = 60;

                // Kaiser also requires transition band
                this.TransitionBand = 500;
            }

            if (this.myFreqFrom == 0.0f && this.myFreqTo == 0.0f)
            {
                this.myFFT.FreqFrom = 1000;
                this.myFFT.FreqTo   = 1000f;
            }
            else
            {
                this.myFFT.FreqFrom = this.myFreqFrom;
                this.myFFT.FreqTo   = this.myFreqTo;
            }

            this.myCoeff = this.myFFT.GenerateCoefficients(this.CurrentFilter, this.CurrentAlgorithm);
        }
Example #2
0
        /// <summary>
        /// Performs the actual filtering operation with respect to input from the combo boxes.
        /// </summary>
        private void FilterCalculation(ref float[] input, FFT.FilterType filter)
        {
            // Check what kind of filter the user wanted and filter accordingly
            switch (filter)
            {
            case FFT.FilterType.HighPass:
                firFilter.HighPassFilter(ref input);
                break;

            case FFT.FilterType.LowPass:
                firFilter.LowPassFilter(ref input);
                break;

            case FFT.FilterType.BandPass:
                firFilter.BandPassFilter(ref input);
                break;
            }
        }