Matlab中加汉明窗 ahmming 作用
转自:http://www.cnblogs.com/lxy2017/p/4049124.html
1.什么是汉明窗?
语音信号一般在10ms到30ms之间,我们可以把它看成是平稳的。为了处理语音信号,我们要对语音信号进行加窗,也就是一次仅处理窗中的数据。因为实际的语音信号是很长的,我们不能也不必对非常长的数据进行一次性处理。明智的解决办法就是每次取一段数据,进行分析,然后再取下一段数据,再进行分析。
怎么仅取一段数据呢?一种方式就是构造一个函数。这个函数在某一区间有非零值,而在其余区间皆为0.汉明窗就是这样的一种函数。它主要部分的形状像sin(x)在0到pi区间的形状,而其余部分都是0.这样的函数乘上其他任何一个函数f,f只有一部分有非零值。
为什么汉明窗这样取呢?因为之后我们会对汉明窗中的数据进行FFT,它假设一个窗内的信号是代表一个周期的信号。(也就是说窗的左端和右端应该大致能连在一起)而通常一小段音频数据没有明显的周期性,加上汉明窗后,数据形状就有点周期的感觉了。
因为加上汉明窗,只有中间的数据体现出来了,两边的数据信息丢失了,所以等会移窗的时候,只会移1/3或1/2窗,这样被前一帧或二帧丢失的数据又重新得到了体现。
简单的说汉明窗就是个函数,它的形状像窗,所以类似的函数都叫做窗函数。
2.加Hanmming窗的作用
现在在看G.723.1,对语音编码刚入门,
发现在对信号进行LPC分析前,对信号乘以一个Hamming 窗,
典型的窗口大小是25ms,帧移是10ms。汉明窗函数为
W(n,α ) = (1 -α ) - α cos(2*PI*n/(N-1)),0≦n≦N-1
一般情况下,α取0.46 。
转自:https://ww2.mathworks.cn/help/signal/ref/hamming.html
用法:
hamming
Hamming window
returns an w
= hamming(L
)L
-point symmetric Hamming window.
returns a Hamming window using the window sampling specified by w
= hamming(L
,sflag
)sflag
.
Examples
Create a 64-point Hamming window. Display the result using wvtool
.
L = 64; wvtool(hamming(L))
Input Arguments
L
— Window length positive integer
Window length, specified as a positive integer.
Data Types:single
| double
sflag
— Window sampling \'symmetric\'
(default) | \'periodic\'
Window sampling, specified as one of the following:
\'symmetric\'
— Use this option when using windows for filter design.\'periodic\'
— This option is useful for spectral analysis because it enables a windowed signal to have the perfect periodic extension implicit in the discrete Fourier transform. When\'periodic\'
is specified,hamming
computes a window of length L + 1 and returns the first L points.
Output Arguments
w
— Hamming window column vector
Hamming window, returned as a column vector.
Algorithms
The following equation generates the coefficients of a Hamming window:
w(n)=0.54−0.46cos(2πnN),0≤n≤N.
The window length L = N + 1.
References
[1] Oppenheim, Alan V., Ronald W. Schafer, and John R. Buck. Discrete-Time Signal Processing. Upper Saddle River, NJ: Prentice Hall, 1999.
Extended Capabilities
C/C++ Code Generation Generate C and C++ code using MATLAB® Coder™.
See Also
Apps
Functions
blackman
|flattopwin
|hann
|window
|wvtool
Introduced before R2006a
- 上一篇 »html中加入虚线
- 下一篇 »css中margin:0 auto没作用