快速傅里叶变换(FFT)输入和输出以分析Java中音频文件的频率? [英] Fast Fourier Transform (FFT) input and output to analyse the frequency of audio files in Java?

查看:695
本文介绍了快速傅里叶变换(FFT)输入和输出以分析Java中音频文件的频率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须使用FFT分析音频文件的频率.但是我不知道输入和输出是什么.

I have to use FFT to analyse the frequency of an audio file. But I don't know what the input and output is.

如果要绘制频谱的音频文件,是否必须使用1维,2维或3维阵列?有人可以建议我在J2ME上使用FFT库吗?

Do I have to use 1-dimension, 2-dimension or 3-dimension array if I want to draw the spectrum's audio file? And can someone suggest me library for FFT on J2ME?

推荐答案

@thongcaoloi

@thongcaoloi,

关于输入数据的维数的简单答案是:您需要一维数据.现在,我将解释这是什么意思.

The simple answer regarding the dimensionality of your input data is: you need 1D data. Now I'll explain what that means.

因为要分析音频数据,所以离散傅立叶变换(DFT或FFT)的输入是一维实数序列,它表示音频信号随时间变化的电压,以及音频文件是该电压随时间变化的数字表示.

Because you want to analyze audio data, your input to the discrete Fourier transform (DFT or FFT), is a 1-dimensional sequence of real numbers, which represents the changing voltage of the audio signal over time, and your audio file is a digital representation of that changing voltage over time.

您的音频文件是通过以固定采样率(也称为采样频率)对连续音频信号的电压进行采样而产生的,对于CD品质的音频,采样率通常为44.1 KHz.

Your audio file was produced by sampling the voltage of a continuous audio signal at a fixed sampling rate (also known as the sampling frequency), typically 44.1 KHz for CD quality audio.

但是您的数据文件本来可以以较低的频率采样的,所以在对数据进行FFT之前,请先尝试找出数据的采样频率.

But your data file could have been sampled at a much lower frequency, so try to find out the sampling frequency of your data before you do an FFT on that data.

因此,现在您必须从音频文件中提取单个样本.如果您的文件是立体声文件,它将有两个单独的采样序列,一个用于右声道,一个用于左声道.如果文件是单声道文件,那么它将只有一个样本序列.

So now you have to extract the individual samples from your audio file. If your file is stereo, it will have two separate sample sequences, one for the right channel and one for the left channel. If the file is mono, it will have only one sample sequence.

如果文件是立体声或其他任何多声道音频格式(例如5.1或7.1),则可以分别对每个声道进行FFT,或者可以通过加电压将任意数量的声道组合在一起.这取决于您,并且取决于您要如何处理FFT结果.

If your file is stereo, or any other multi-channel audio format such as 5.1 or 7.1, you could FFT each channel separately, or you could combine any number of channels together using voltage addition. That's up to you, and depends on what you're trying to do with your FFT results.

DFT或FFT的输出是复数序列.每个复数都是一对,由实部和虚部组成,通常显示为对(re,im).

The output of the DFT or FFT is a sequence of complex numbers. Each complex number is a pair consisting of a real-part and an imaginary-part, typically shown as a pair (re,im).

如果要绘制音频文件的功率谱密度(这是大多数人希望从FFT获得的功率谱密度),则将使用第一个图形20 * log10(sqrt(re ^ 2 + im ^ 2)) N/2个FFT输出的复数,其中N是FFT的输入采样数.

If you want to graph the power spectral density of your audio file, which is what most people want from the FFT, you'll graph 20*log10( sqrt( re^2 + im^2 ) ), using the first N/2 complex numbers of the FFT output, where N is the number of input samples to the FFT.

您可以尝试构建自己的频谱分析仪软件程序,但是我建议您使用已经构建并经过测试的工具.

You can try to build your own spectrum analyzer software program, but I suggest using something that's already built and tested.

这两个FFT频谱分析仪可立即提供结果,并具有内置的IFFT合成功能,这意味着您可以对傅立叶逆变换频域频谱数据,从而在时域中重建原始信号.

These two FFT spectrum analyzers give results instantly, and have built-in IFFT synthesis, meaning that you can inverse Fourier transform the frequency-domain spectral data to reconstruct the original signal in the time-domain.

http://www.mathworks.com/help/techdoc/ref/fft.html

http://www.sooeet.com/math/fft.php

这个主题以及一般的数字信号处理主题还有很多,但是这个简短的介绍应该可以帮助您入门.

There's a lot more to this topic, and to the subject of digital signal processing in general, but this brief introduction, should get you started.

这篇关于快速傅里叶变换(FFT)输入和输出以分析Java中音频文件的频率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆