예제 #1
0
        private void TestCurrentNote()
        {
            var filePath = GetCurrentNotePath();

            var waveReader    = new WaveDataFileReader(filePath);
            var audioAnalyzer = new AudioAnalyzer(waveReader)
            {
                FftLength = 1024 * 16
            };

            audioAnalyzer.AnalyzeValues();

            var result       = audioAnalyzer.FindMaxAmplitudeInScope();
            var actualResult = new NoteAnalyzer().CheckNote(result.Frequency);

            AssertNote(actualResult);
        }
예제 #2
0
        private void UpdatePlots(string fileName)
        {
            var waveReader = new WaveDataFileReader(fileName);

            _audioAnalyzer = new AudioAnalyzer(waveReader)
            {
                FftLength = 1024 * 16
            };
            _audioAnalyzer.AnalyzeValues();

            audioPlotUc1.Analyzer = _audioAnalyzer;
            audioPlotUc1.UpdatePlot();

            fftPlotUc1.Analyzer = _audioAnalyzer;
            fftPlotUc1.UpdatePlot();

            var result = _audioAnalyzer.FindMaxAmplitudeInScope();

            noteIndication.MaxMagnitudeInDb      = result.Amplitude;
            noteIndication.MaxMagnitudeFrequency = result.Frequency;
            noteIndication.NoteName = new NoteAnalyzer().CheckNote(result.Frequency);
            noteIndication.UpdateControl();
        }