我想創建一個處理應用程序,它能夠從樂器(吉他)中檢測音符。例如,如果播放打開的「A」音符,我想根據該音符進行操作,例如在屏幕上顯示音符或顯示圖像。注意檢測與處理和最小
我被卡住了,不確定我是否正確地做了或者如何繼續。據我所知,我需要獲得基本頻率?如果是這樣,我該如何得到它?看起來就像現在我在演奏音符時,隨着音符的進展,草圖顯示了一系列不同的頻率。我應該只是試圖獲得音符的開始或什麼?
如果你不能告訴,I'lm對於新手,所以要溫柔;)這是我到目前爲止有:
/* sketch to measure frequencies */
import ddf.minim.analysis.*;
import ddf.minim.*;
Minim minim;
AudioInput in;
FFT fft;
void setup()
{
size(512, 200, P3D);
minim = new Minim(this);
in = minim.getLineIn(Minim.STEREO, 2048);
// create an FFT object that has a time-domain buffer
// the same size as jingle's sample buffer
// note that this needs to be a power of two
// and that it means the size of the spectrum
// will be 512. see the online tutorial for more info.
fft = new FFT(in.bufferSize(), 44100);
}
void draw()
{
background(0);
stroke(255);
// perform a forward FFT on the audip that's coming in
fft.forward(in.mix);
for(int i = 0; i < fft.specSize(); i++)
{
// draw the line for frequency band i, scaling it by 4 so we can see it a bit better
line(i, height, i, height - fft.getBand(i) * 4);
//print out the frequency. Am I supposed to be multiplying the value by 2048?
println((fft.getFreq(i) * 2048));
}
fill(255);
}
void stop()
{
// always close Minim audio classes when you finish with them
in.close();
minim.stop();
super.stop();
}
我認爲你需要做一些關於基音檢測的基礎知識的更多研究。嘗試維基百科,SO或其他問題,或這篇博文:http://blog.bjornroche.com/2012/07/frequency-detection-using-fft-aka-pitch.html – 2013-04-26 16:50:14
謝謝比約恩。這看起來像一篇很棒的文章。我會閱讀它並嘗試儘可能多地學習理論。但是我不用C編碼。有沒有什麼建議可以讓我在這個處理過程中向前邁進? – 2013-04-26 17:16:00
這篇文章中的C代碼示例與您在Java/Processing中做的任何事情非常相似,並且概念是相同的。 – 2013-04-26 20:15:29