本文介绍了在Java中使用FFT算法音频频谱分析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
欲分析的Java(ME)的音频文件的频谱。我想提请频谱一些媒体播放器做的。但我不明白几点:
- 输入的FFT算法,我从音频文件获得。我现在它叫什么不这样做,它是什么,更重要的,我不知道如何得到它。
- 输出:(?范围),如果输入的是一个数组我获得其他阵列,并有范围:0-1,右(或没有)?所以,我有什么关系呢?
解决方案
您需要在除了FFT一些额外的步骤。这一问题已经在SO涵盖了许多次了在previous这里类似的问题,你可以通过搜索DSP,FFT,谱,频谱查找其他材料等,但本质上则需要做到以下几点:
- 应用输入数据(如的)
- 适用于FFT窗的输入数据(复杂到复杂FFT虚的投入都应该是零)
- 首先计算
N / 2
FFT输出纸盒的平方值(重*重+ IM * IM
) - 转换平方幅度分贝标度(
10 * LOG10(squared_magnitude)
)
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:
- 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 important, I don't know how to get it.
- 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)
)
这篇关于在Java中使用FFT算法音频频谱分析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!