FFT的窗口大小与数据长度 [英] Window size vs data length for FFT

查看:2005
本文介绍了FFT的窗口大小与数据长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试对流音频数据进行快速频谱分析,以捕获元音(类似于JLip-sync).使用PyAudio在短时间内(0.0625秒)以小块(1024)捕获语音数据.使用numpy.fft进行分析,并使用numpy.hanning窗口消除泄漏.我使用4096 * 4作为采样率(不是44100或22050,并且也有待讨论; 4096 * 4最接近22050).

I am trying to do a quick spectral analysis on the streaming audio data to capture vowels (something like JLip-sync). Using PyAudio to capture the voice data in small chunks (1024) for short durations (0.0625 sec.). Using numpy.fft for the analysis, and to get rid of leakage using numpy.hanning window. I am using 4096*4 as the sampling rate (not 44100 or 22050, and open to discussion as well; 4096*4 being nearest to 22050).

考虑到我感兴趣的频率(从300 Hz到3000Hz),如何使用所需的数据长度和最小/最大频率来计算理想的窗口大小?

Considering the frequencies I am interested in (ranging from 300 Hz to 3000Hz) how can the ideal window size be calculated using data length and min/max frequencies I am looking for?

谢谢.

Kadir

推荐答案

@Kadir:

在对数据进行离散傅里叶变换(DFT或FFT)处理之前,先对数据进行窗口化处理是为了最大程度地减少频谱泄漏,这种泄漏是在尝试对非周期性数据进行傅里叶变换时发生的.

The purpose of windowing your data before processing it with a discrete Fourier transform (DFT or FFT), is to minimize spectral leakage, which happens when you try to Fourier-transform non-cyclical data.

窗口化的工作原理是在序列的开始和结尾(而不是之前)强制将数据平滑地强制为零.缩短窗口会不必要地破坏信息.

Windowing works by forcing your data smoothly to zero at exactly the start and end of the sequence, but not before. Shortening your window destroys information unnecessarily.

因此,窗口长度应与样本序列的长度匹配.例如,对于1024个样本,您的窗口长度应为1024.

So your window length should match the length of your sample sequences. For instance, with 1024 samples, your window length should be 1024.

如果要解析的最高频率是3 KHz,请以不同的采样率使用8192个或更多样本,例如16384或32768样本.

If the highest frequency you want to resolve is 3 KHz, use 8192 samples or more, such as 16384, or 32768 samples, at various sampling rates.

还尝试使用不同的FFT算法,不同的采样长度和不同的窗口,包括Hann(Hanning),以及其他具有更好旁瓣衰减的窗口,例如Blackman-Harris系列和Kaiser-Bessel系列等

Also, try a different FFT algorithm, different sample lengths, and different windows, including the Hann (Hanning), but also other windows with better side lobe attenuation, such as the Blackman-Harris series, and the Kaiser-Bessel series, etc.

如果您的应用程序嘈杂,则可能必须在更好的噪声抑制窗口和更高的光谱分辨率窗口之间进行选择.因此,尝试不同的窗口是一个好主意,这样您就可以为您的应用程序找到最好的窗口.

If your application is noisy, you may have to choose between the better noise suppression windows, and the higher spectral resolution windows. So it's a good idea to try different windows, so you can find the best one for your application.

现在,记下每个设置的结果(即每个窗口,样本长度,采样率等),并查找在多个设置中一致的结果.您将学到很多有关数据的知识,很可能会找到问题的答案.

Now, write down your results with each setup (i.e. with each window, sample length, sampling rate, etc.), and look for results that agree across multiple setups. You will learn much about your data, and very likely find the answer to your problem.

您可以使用Matlab进行此操作: http://www.mathworks.com/help/techdoc/ref/fft.html

You can do this with Matlab: http://www.mathworks.com/help/techdoc/ref/fft.html

或使用此在线FFT频谱分析仪: http://www.sooeet.com/math/fft.php

Or with this online FFT spectrum analyzer: http://www.sooeet.com/math/fft.php

别忘了在这里发布结果.

And don't forget to post your results here.

这篇关于FFT的窗口大小与数据长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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