AudioVisualizeView icon indicating copy to clipboard operation
AudioVisualizeView copied to clipboard

請教 `VisualizerHelper` 的 `onFftDataCapture` 程式碼片段

Open tobeylin opened this issue 3 years ago • 0 comments

你好 因為近期也在研究這塊,網路上爬了很多資料

想請教在 VisualizerHelperonFftDataCapture 程式碼片段裡

為什麼只需要計算 mCount*2 的 magnitude 呢?

mCount*2 小於 fft.length / 2,那麼 mCount*2+1~fft.length/2 的資料就直接捨棄了嗎?

for (int i = 2; i < mCount *2;) {
    model[j] = (float) Math.hypot(fft[i], fft[i + 1]);
    i += 2;
    j++;
    model[j] = Math.abs(model[j]);
}

先說聲謝謝!這個 repo 幫助了我很多!

tobeylin avatar Dec 27 '21 09:12 tobeylin