我如何获得 Chuck 中麦克风的频率?
How do i get the frequency of the microphone in ChucK?
我需要获得麦克风输入的频率,以便根据麦克风音调在音序器或任何乐器上播放某些音符。
我使用此代码输出 de 麦克风
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
}
我需要获得麦克风输入的频率,以便根据麦克风音调在音序器或任何乐器上播放某些音符。 我使用此代码输出 de 麦克风
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
}