audioflux.type.WindowType
- class audioflux.type.WindowType(value)
Window Type
- Attributes
- HANN:
\(\quad w(n)=0.5\left( 1-\cos \left(2\pi \cfrac n{N} \right)\right) , 0 \le n \le N\)
- HAMM:
\(\quad w(n)=0.54 - 0.46\cos \left(2\pi \cfrac n{N} \right)\ , 0 \le n \le N\)
- BLACKMAN:
\(\quad w(n)=0.42 - 0.5\cos \left(2\pi \cfrac n{N-1} \right)\ +0.08\cos\left( 4\pi\cfrac n{N-1} \right) , 0 \le n \le M-1\)
M=N/2,(N+1/2) 当N为偶数、奇数时
- KAISER:
\(\quad w(n)=\cfrac {I_0 \left( eta \sqrt{1- \left( { \cfrac {n-N/2}{N/2} } \right)^2 } \right) } {I_0(eta)} , 0 \le n \le N\)
\(I_0(\beta)\) 为零阶第一类修正贝塞尔函数,可有下面公式级数计算,\(I_0(eta)=1+\sum_{k=1}^{\infty} \left[ \cfrac1{k!} \left (\cfrac eta 2 \right)^k \right] ^2\),一般取15项左右\(\beta=\begin {cases} 0.1102(\alpha_s-8.7), & \alpha_s>50 \\ 0.5842(\alpha_s-21)^{0.4}+0.07886(\alpha_s-21), & 50 \ge \alpha_s \ge 21 \\ 0, & \alpha_s <21 \end {cases} \quad \alpha_s\) 为旁瓣衰减dB默认 \(\beta=5\)- BARTLETT:
\(\quad w(n)=\begin{cases} \cfrac{2n}N, & 0 \le n \le \cfrac N{2} \ 2-\cfrac{2n}N, & \cfrac N{2} \le n \le N \end{cases}\)
Bartlett和Triang非常相似,Bartlett首尾处为0,Triang不为0
- TRIANG:
- \(N\) 为奇数时,\(\quad w(n)=\begin{cases} \cfrac{2n}{N+1}, & 1 \le n \le \cfrac {N+1}{2} \\ 2-\cfrac{2n}{N+1}, & \cfrac {N+1}2 \le n \le N \end{cases}\)\(N\) 为偶数时,\(\quad w(n)=\begin{cases} \cfrac{2n-1}N, & 1 \le n \le \cfrac N{2} \\ 2-\cfrac{2n-1}N, & \cfrac{N}2 +1 \le n \le N \end{cases}\)
- FLATTOP:
\(\quad w(n)=a_0-a_1\cos\left( \cfrac{2\pi n}{N-1} \right) + a_2\cos\left( \cfrac{4\pi n}{N-1} \right) -a_3\cos\left( \cfrac{6\pi n}{N-1} \right) +a_4\cos\left( \cfrac{8\pi n}{N-1} \right)\)
\(\begin{cases} a_0 =0.21557895 \\ a_1= 0.41663158 \\ a_2= 0.277263158 \\ a_3= 0.083578947 \\ a_4= 0.006947368 \end{cases}\)
- GAUSS:
\(\quad w(n)=e^{-n^2/2\sigma^2} =e^{ -\frac12 \left( \alpha \frac{n}{ (N-1)/2 } \right)^2 } , \qquad -(N-1)/2 \le n \le (N-1)/2\)
x使用linspace产生,使用窗长度N,窗首尾强制设为0
- TUKEY:
\(w(x)= \begin{cases} \frac1{2}(1+ \cos(\frac{2\pi}{\alpha} [x-\alpha/2] ) ) ,& 0 \le x \le \cfrac\alpha{2} \\ 1, & \cfrac \alpha{2} \le x <1-\cfrac\alpha{2} \\ \frac1{2}(1+ \cos(\frac{2\pi}{\alpha} [x-1+\alpha/2] ) ) ,& 1-\cfrac\alpha{2} \le x \le 1 \end{cases}\)
x使用linspace产生,使用窗长度N默认 \(\alpha=0.5\)
Attributes
RECT
HANN
HAMM
BLACKMAN
KAISER
BARTLETT
TRIANG
FLATTOP
GAUSS
BLACKMAN_HARRIS
BLACKMAN_NUTTALL
BARTLETT_HANN
BOHMAN
TUKEY