protected override void ProcessData(short[] data)
            {
                double[] x = new double[data.Length];
                for (int i = 0; i < x.Length; i++)
                {
                    x[i] = data[i] / 32768.0;
                }

                double freq = FrequencyUtils.FindFundamentalFrequency(x, SampleRate, MinFreq, MaxFreq);

                owner.OnFrequencyDetected(new FrequencyDetectedEventArgs(freq));
            }
Exemple #2
0
            protected override void ProcessData(short[] data)
            {
                double[] x = new double[data.Length];
                for (int i = 0; i < x.Length; i++)
                {
                    x[i] = data[i] / 32768.0;
                }

                if (Wavelet.Pitchtracker.counter == 0)
                {
                    double freq = FrequencyUtils.FindFundamentalFrequency(x, SampleRate, MinFreq, MaxFreq);
                    owner.OnFrequencyDetected(new FrequencyDetectedEventArgs(freq));
                }
                else
                {
                    Wavelet.Pitchtracker.dywapitchtracker pitchtracker = new Wavelet.Pitchtracker.dywapitchtracker();
                    Wavelet.Pitchtracker.dywapitch_inittracking(ref pitchtracker);
                    double freq = Wavelet.Pitchtracker.dywapitch_computepitch(ref pitchtracker, x, 0, x.Length);
                    owner.OnFrequencyDetected(new FrequencyDetectedEventArgs(freq));
                }
            }