开发者

Audio spectrum analysis using FFT algorithm in Java

I want to analyze the spectrum of an audio file in Java (ME). I want to draw spectrum as some media players do. But I don't understand some points:

  1. Input for FFT algorithm, which I have to get from the audio file. I don't now what it is called, what it is and more impo开发者_StackOverflow社区rtant, I don't know how to get it.
  2. Output: if input is an array (range?) I obtain other array, and it have range: 0-1, right (or not)? So what I have to do with it?


You need a few additional steps in addition to the FFT. This has been covered many times already in previous similar questions here on SO, and you can find additional material by searching for "dsp", "fft", "spectrum", "spectrogram", etc, but essentially you need to do the following:

  • apply a window function to the input data (e.g. Hann(ing))
  • apply FFT to windowed input data (for complex-to-complex FFT the imaginary inputs should all be zero)
  • calculate squared magnitude of first N / 2 FFT output bins (re * re + im * im)
  • convert squared magnitude to dB scale (10 * log10(squared_magnitude))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜