/// <summary> /// パラメータを指定して新しい FFTFiltering クラスのインスタンスを初期化します。 /// </summary> /// <param name="filterSize">フィルタサイズ。</param> /// <param name="segmentSize">セグメントサイズ。segmentSize は filterSize 未満 かつ fftSize 未満でなくてはなりません。</param> /// <param name="fftSize">FFT サイズ。fftSize は bufferSize 未満でなくてはなりません。</param> /// <param name="bufferSize">バッファサイズ。</param> public FFTFiltering(int filterSize, int segmentSize, int fftSize, int bufferSize) { if (segmentSize < filterSize) throw new ArgumentException("segmentSize は filterSize 未満でなくてはなりません。"); if (fftSize <= segmentSize) throw new ArgumentException("segmentSize は fftSize 未満でなくてはなりません。"); if (fftSize > bufferSize) throw new ArgumentException("fftSize は bufferSize 未満でなくてはなりません。"); this.filterSize = filterSize; this.segmentSize = segmentSize; this.fftSize = fftSize; this.overlapSize = fftSize - segmentSize; this.bufferSize = bufferSize; this.fr = new double[fftSize]; this.fi = new double[fftSize]; this.xr = new double[fftSize]; this.fft_c = new double[fftSize * 2]; this.overlap = new double[overlapSize]; this.output = new double[bufferSize]; this.fft = new FastFourier(fftSize * 2); }
/// <summary> /// パラメータを指定して新しい FFTFiltering クラスのインスタンスを初期化します。 /// </summary> /// <param name="filterSize">フィルタサイズ。</param> /// <param name="segmentSize">セグメントサイズ。segmentSize は filterSize 未満 かつ fftSize 未満でなくてはなりません。</param> /// <param name="fftSize">FFT サイズ。fftSize は bufferSize 未満でなくてはなりません。</param> /// <param name="bufferSize">バッファサイズ。</param> public FFTFiltering(int filterSize, int segmentSize, int fftSize, int bufferSize) { if (segmentSize < filterSize) { throw new ArgumentException("segmentSize は filterSize 未満でなくてはなりません。"); } if (fftSize <= segmentSize) { throw new ArgumentException("segmentSize は fftSize 未満でなくてはなりません。"); } if (fftSize > bufferSize) { throw new ArgumentException("fftSize は bufferSize 未満でなくてはなりません。"); } this.filterSize = filterSize; this.segmentSize = segmentSize; this.fftSize = fftSize; this.overlapSize = fftSize - segmentSize; this.bufferSize = bufferSize; this.fr = new double[fftSize]; this.fi = new double[fftSize]; this.xr = new double[fftSize]; this.fft_c = new double[fftSize * 2]; this.overlap = new double[overlapSize]; this.output = new double[bufferSize]; this.fft = new FastFourier(fftSize * 2); }
/// <summary> /// 周波数特性から有限インパルス応答を生成します。 /// </summary> /// <param name="input">周波数応答。</param> /// <param name="output">生成された有限インパルス応答。</param> public static void Generate(double[] input, double[] output) { if (input == null) throw new ArgumentNullException("input"); if (output == null) throw new ArgumentNullException("output"); if (input.Length * 2 != output.Length) throw new ArgumentException(); int filterLength = output.Length; int blockSize = filterLength / 2; FastFourier fft = new FastFourier(filterLength * 2); Array.Clear(output, 0, filterLength); double[] im_dummy = new double[filterLength]; Array.Copy(input, 0, output, blockSize, blockSize); Array.Reverse(output, blockSize, blockSize); Array.Copy(input, 0, output, 0, blockSize); fft.TransformComplex(true, output, im_dummy); Array.Reverse(output, 0, blockSize); Array.Reverse(output, blockSize, blockSize); Array.Reverse(output, 0, filterLength); }
/// <summary> /// 周波数特性から有限インパルス応答を生成します。 /// </summary> /// <param name="input">周波数応答。</param> /// <param name="output">生成された有限インパルス応答。</param> public static void Generate(double[] input, double[] output) { if (input == null) { throw new ArgumentNullException("input"); } if (output == null) { throw new ArgumentNullException("output"); } if (input.Length * 2 != output.Length) { throw new ArgumentException(); } int filterLength = output.Length; int blockSize = filterLength / 2; FastFourier fft = new FastFourier(filterLength * 2); Array.Clear(output, 0, filterLength); double[] im_dummy = new double[filterLength]; Array.Copy(input, 0, output, blockSize, blockSize); Array.Reverse(output, blockSize, blockSize); Array.Copy(input, 0, output, 0, blockSize); fft.TransformComplex(true, output, im_dummy); Array.Reverse(output, 0, blockSize); Array.Reverse(output, blockSize, blockSize); Array.Reverse(output, 0, filterLength); }
public void Init(int _fourierSize) { InitMaterials(); InitRenderTextures(_fourierSize); CreateCmd(); mSpectrumDrawer.SetInt("_FourierSize", _fourierSize); mFastFourier = new FastFourier(_fourierSize); mFFTOceanOutputer = new FFTOceanOutputer(_fourierSize); mCurStage = eStage.UpdateSpectrum; }