Пример #1
0
        public async void OpenFile(string fn)
        {
            this.Cursor = Cursors.Wait;
            Analyzer    = new AudioLib.Analyzer(fn);
            Settings.Instance.SamplingFreq = Analyzer.SampleRate;
            //analyzer.Dft();
            //analyzer.CalcSpectrogram();
            await Task.Run(() => Analyzer.CalcPower());

            await Task.Run(() => Analyzer.CalcPitch());

            this.Cursor = null;
            //SetSpector(analyzer.Freq.Select((x, i) => new OxyPlot.DataPoint(analyzer.FreqPerIndex * i, x)));

            plot.Model  = SetSpectrogram(Analyzer.Pitch.Select((x, i) => new OxyPlot.DataPoint(i / (double)Settings.Instance.SamplingFreq, x)));
            plot2.Model = SetPowergram(Analyzer.PowerTime.Select((x, i) => new OxyPlot.DataPoint(i / (double)Settings.Instance.SamplingFreq, x)));
            plot2.InvalidatePlot();
            plot.InvalidatePlot();

            DevelopManager.SetSource(Analyzer.Pitch.Select(x => x / (FileUtil.SampleRate / 2)).ToArray(), Analyzer.PowerTime);
        }
Пример #2
0
 public bool IsValidWaveform()
 {
     Analyzer.CalcPitch();
     return(Analyzer.Pitch.Any(x => x != 0));
 }