// 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 = mediadirpitch; 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); }
public static void operations_test(AudioPlayer pl) { WaveAudio noteLongLow = new Triangle(Triangle.FrequencyFromMidiNote(60), 0.5).CreateWaveAudio(1.0); WaveAudio noteShortHi = new Triangle(Triangle.FrequencyFromMidiNote(64), 0.5).CreateWaveAudio(0.5); pl.Play(WaveAudio.Concatenate(noteLongLow, noteShortHi)); pl.Play(WaveAudio.Concatenate(noteShortHi, noteLongLow)); pl.Play(WaveAudio.Mix(noteShortHi, noteLongLow)); pl.Play(WaveAudio.Mix(noteLongLow, noteShortHi)); WaveAudio tmp = new Sine(200,1.0).CreateWaveAudio(4.0); tmp.setNumChannels(2, true); pl.Play(WaveAudio.Modulate(new WaveAudio(mediadir+"d44k16bit2ch.wav"), tmp)); WaveAudio cp; cp = noteLongLow.Clone(); cp.FadeIn(0.3); pl.Play(cp); cp = noteLongLow.Clone(); cp.FadeOut(0.3); pl.Play(cp); cp = noteLongLow.Clone(); cp.Amplify(0.5); pl.Play(cp); cp = noteLongLow.Clone(); cp.Amplify(2.0); pl.Play(cp); }