示例#1
0
        private void NewFrame(object sender, NewFrameEventArgs eventArgs)
        {
            //FFT
            var freq = FFTMethod.ProcessThread(eventArgs.Signal.ToFloat(), eventArgs.Signal.SampleRate, MinFreq, MaxFreq);

            ShowFreq(freq);
            //Accord
            //ComplexSignal complexSignal = ComplexSignal.FromSignal(eventArgs.Signal);
            //complexSignal.ForwardFourierTransform();
            //Complex[] channel = complexSignal.GetChannel(0);//хз почему, но channel 0 дает лучше результат
            //double[] powerSpectrum = Tools.GetPowerSpectrum(channel);
            //double[] frequencyVector = Tools.GetFrequencyVector(complexSignal.Length, complexSignal.SampleRate);
            //powerSpectrum[0] = 0.0;
            //ShowFreq(frequencyVector[powerSpectrum.GetIndexOfMax()]);
        }
示例#2
0
 protected override void ProcessData(Single[] data)
 {
     //_form.ShowFreq(FrequencyUtil.DetectPitch(data, SampleRate, MinFreq, MaxFreq));
     _form.ShowFreq(FFTMethod.ProcessThread(data, SampleRate, MinFreq, MaxFreq));
 }