public SampleAggregator(int fftLength) { if (!IsPowerOfTwo(fftLength)) { throw new ArgumentException("FFT Length must be a power of two"); } this.m = (int)Math.Log(fftLength, 2.0); this.fftLength = fftLength; this.fftBuffer = new Complex[fftLength]; this.fftArgs = new FftEventArgs(fftBuffer); }
void FftCalculated(object sender, FftEventArgs e) { c = e.Result; freq_str = ""; if (c != null) { for (int i = 0; i < spectre_peaks.Length; i++) { last_peaks[i] = spectre_peaks[i]; } nullify_spectre_peaks(); for (int j = 0; j < fftLength / 2; j++) { y[j] = (float)((Math.Sqrt(c[j].X * c[j].X + c[j].Y * c[j].Y))); freq = j * 44100f / fftLength; freq_str += freq + "\n"; set_spectre_peak(freq, y[j]); Invalidate(); } Invalidate(); } }
void FftCalculated(object sender, FftEventArgs e) { c = e.Result; //e.Result; // Do something with e.result! }