Exemple #1
0
        private void UpdateAutoCorrelation()
        {
            var pos = _hopSize * _specNo;

            var pitch = //Pitch.FromHss(_signal, pos, pos + _fftSize);
                        Pitch.FromAutoCorrelation(_signal, pos, pos + _fftSize, 80, 1000);

            //Pitch.FromZeroCrossingsSchmitt(_signal, pos, pos + _fftSize);
            //Pitch.FromYin(_signal, pos, pos + _fftSize);

            spectrumPanel.Mark   = (int)(_fftSize * pitch / _signal.SamplingRate);  // pitch index
            spectrumPanel.Legend = string.Format("{0:F2} Hz", pitch);

            var block           = _signal[pos, pos + _fftSize];
            var autoCorrelation = Operation.CrossCorrelate(block, block).Last(_fftSize);

            autoCorrPanel.Line = autoCorrelation.Samples;
            autoCorrPanel.Mark = pitch == 0 ? 0 : (int)(_signal.SamplingRate / pitch);   // pitch index
        }