我需要得到麦克风输入的频率,以便在音序器或任何乐器上播放某些音符,这取决于麦克风的音色。
adc => dac;
while(true){
0.1::second=>now;
}
有没有什么功能是用在adb上的,能够做到我想要的东西呢?:D
最简单的方法是修改Spectral Centroid UAna的例子。
/// sending the mic through the analysis instead of SinOsc
adc => FFT fft =^ Centroid cent => blackhole;
float trackedFrequency;
512 => fft.size;
Windowing.hann(512) => fft.window;
second / samp => float srate;
while( true )
{
cent.upchuck();
// modifying the example to put the analysis in a variable
cent.fval(0) * srate / 2 => trackedFrequency;
<<< trackedFrequency >>>; // use it set the frequency of something else
fft.size()::samp => now; // advance time
}