我需要获取来自麦克风输入的频率,以便根据麦克风音调在音序器或任何乐器上播放某些音符。我使用此代码输出麦克风
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
}