// Test between 20Hz and 500Hz. This works very well, although it is hard to eliminate octave errors // This test will play original, then a sine at the frequency it detected. The two should line up. private static void pitchdetectwav(AudioPlayer pl, string strFilename, PitchDetection.PitchDetectAlgorithm algorithm) { string strInstdir = mediadir + @"pitchdetect\"; WaveAudio w = new WaveAudio(strInstdir + strFilename); if (w.getNumChannels() != 1) { w.setNumChannels(1, true); } double dfreq = PitchDetection.DetectPitch(w, 50, 500, algorithm); WaveAudio testPitch = new Triangle(dfreq, 0.7).CreateWaveAudio(1.0); pl.Play(w); pl.Play(testPitch); }