private void CalculateSpec() { answer = new MySeries[sample.end * 2 / Setting.FrameLength - 1]; Complex[] buff = new Complex[Setting.FrameLength]; for (int frame = 0; frame < answer.Length; frame++) { SetLabelValue(frame * 100 / answer.Length); SetBarValue(frame * 100 / answer.Length); for (int i = 0; i < Setting.FrameLength; i++) { buff[i] = sample.data[frame * Setting.FrameLength / 2 + i]; } HammingWindow.Use(buff); FFT.Forward(buff, FourierTransformScaling.ForwardScaling); answer[frame] = new MySeries(); answer[frame].begin = (frame + 1) * Setting.FrameLength / 2; answer[frame].end = answer[frame].begin + Setting.FrameLength - 1; answer[frame].data = new float[Setting.FrameLength]; for (int i = 0; i < Setting.FrameLength; i++) { answer[frame].data[i] = (float)Complex.Abs(buff[i]); } } SetLabelValue(100); SetBarValue(100); this.Invoke(new Action(this.Close)); }
public static double[] ApplyHammingWindow(float[] signal, HammingWindowDef hammingWindowDef = null) { if (hammingWindowDef == null) { hammingWindowDef = new HammingWindowDef(); } var hammingWindow = new HammingWindow(hammingWindowDef, signal.Length); return hammingWindow.Apply(signal); }
private void ComputeHammingWindow(object sender, RoutedEventArgs e) { Signal = new HammingWindow(Signal, M); ChartWrapper.SetSignal(SignalSlot, Signal); ReplotChartAndHistogram(); }