Outline
Amplitude
0.6
• MLT Sine
0.2
• Chebyshev
The window transform was found to be
• Bartlett sin M ω2 ∆
WR (ω) = = M · asincM (ω) (1)
• Poisson sin ω2
• Gaussian where asincM (ω) denotes the aliased sinc function.
∆ sin(M ω/2)
• Optimal Windows asincM (ω) =
M · sin(ω/2)
1 2
This result is plotted below: More generally, we may plot both the magnitude and
DFT of a Rectangular Window of length M = 11
phase of the window versus frequency:
12
8 10
9
6
Amplitude
8
4
7
2
Amplitude
0
5
−2 4
−4 3
−3 −2 −1 0 1 2 3
Normalized Frequency ω (rad/sample)
2
PSfrag replacements 1
Note that this is the complete window transform, not just ω/Ω
−3 −2 −1 0 1 2 3
M Normalized Frequency ω (rad/sample)
3.1416
2.7489
2.3562
1.9635
Phase (rad)
1.5708
1.1781
0.7854
0.3927
PSfrag replacements 0
Main Lobe
−0.3927
−3 −2 −1 0 1 2 3
ω/ΩM Normalized Frequency ω (rad/sample)
3 4
In audio work, we more typically plot the window Since the DTFT of the rectangular window approximates
transform magnitude on a decibel (dB) scale: the sinc function, it should “roll off” at approximately 6
dB per octave, as verified in the log-log plot below:
DFT of a Rectangular Window − M = 11
0
DFT of a Rectangular Window − M = 20
0
−5
−6.0206
main lobe Ideal −6 dB per octave line
−10 −12.0412
13 dB down
−18.0618 Partial
−15
Main
Magnitude (dB)
Amplitude (dB)
−20
−30.103
−25 −36.1236
−42.1442
−30
−48.1648
−35
−54.1854
eplacements nulls nulls PSfrag replacements
−40
−3 −2 −1 0 1 2 3 0.1 0.2 0.4 0.8 1.6 3.2 6.4
(radians per sample) Normalized Frequency ω (rad/sample) ωT (radians per sample) Normalized Frequency (rad/sample)
5 6
7 8
Generalized Hamming Window Family In terms of the rectangular window transform
WR (ω) = M · asincM (ω) (zero-phase, unit-amplitude
case), this can be written as:
Consider the following picture in the frequency domain:
∆
WH (ω) = αWR(ω) + βWR (ω − ΩM ) + βWR (ω + ΩM )
0.5
0.4
Using the Shift Theorem, we can take the inverse
transform of the above equation:
0.3
2πn
0.1 = wR (n) α + 2β cos
M
0
9 10
0.6
0.4
Doing this, results in the following values:
0.2
0
−20 −15 −10 −5 0 5 10 15 20
• α = .54
Time (samples)
• β = (1 − α)/2 (for unit time-domain peak amplitude)
0
−10
−20
Magnitude (dB)
−30 −31.5 dB
−40
eplacements −50
−60
11 12
Hamming Window Hamming Window Properties
1
Hamming Window, M = 21
• Discontinuous “slam to zero” at endpoints
0.8
• main lobe is 4ΩM
Amplitude
0.6
• Roll off is approx. 6 dB / octave (aliased)
0.4
0
Note: The Hamming window could also be called the
−10
−20
“Chebyshev Generalized Hamming Window”. This is
Magnitude (dB)
−50
level within the family. Chebyshev-type designs generally
−60 exhibit equiripple error behavior, since the worst-case
eplacements −70
error (sidelobe level in this case) is minimized.
−3 −2 −1 −2ΩM−1 0 2Ω
M−1
1 2 3
(radians per sample) Normalized Frequency (rad/sample)
13 14
−10
−20
Amplitude
0.6 −30
−40
0.4
−50
−60
0.2 −0.5 −0.4 −0.3 −0.2 −0.1 0 0.1 0.2 0.3 0.4 0.5
Normalized Frequency (cycles per sample)
0
0
−100 −80 −60 −40 −20 0 20 40 60 80 100 Hanning
Magnitude (dB0)
−10
Time (samples)
−20
−30
0 −40
−10 −50
−20 −60
Magnitude (dB)
−0.5 −0.4 −0.3 −0.2 −0.1 0 0.1 0.2 0.3 0.4 0.5
−30 Normalized Frequency (cycles per sample)
0
−40 −42.7 dB Hamming
Magnitude (dB0)
−10
−50 −20
−60 −30
eplacements −70
−40
−50
−3 −2 −1 −2Ω2Ω0
M−1M−1
1 2 3
(radians per sample) −60
Normalized Frequency (rad/sample) −0.5 −0.4 −0.3 −0.2 −0.1 0 0.1 0.2 0.3 0.4 0.5
Normalized Frequency (cycles per sample)
15 16
The MLT Sine Window Blackman-Harris Window Family
∆
where ΩM = 2π/M ,
n = −(M − 1)/2, . . . (M − 1)/2 (M odd).
Special Cases:
• L = 1 ⇒ Rectangular
• L = 2 ⇒ Generalized Hamming
• L = 3 ⇒ Blackman Family
17 18
The Blackman-Harris window family can be very The so-called “Blackman Window” is the specific case in
efficiently implemented in the frequency domain as a which α0 = 0.42 α1 = 0.5, and α2 = 0.08
(2L − 1)-point convolution with the spectrum of the Properties:
unwindowed data. Examples:
• Sidelobes roll off about 18dB per octave (as T → 0)
• Start with a length M rectangular window
• −58dB sidelobe level (worst case)
• Take an M -point DFT
• One degree of freedom used to increase the roll-off
• Convolve the DFT data with the 3-point smoother rate from 6dB/octave to 18 dB per octave
[1/4, 1/2, 1/4] to implement a Hann window
• One degree of freedom used to minimize sidelobes
• Note that the Hann window requires no multiplies in
linear fixed-point data formats • One degree of freedom used to scale the window
• Implement any Blackman window as a 5-point Matlab:
smoother in the frequency domain
N = 101; L = 3; No2 = (N-1)/2; n=-No2:No2;
ws = zeros(L,3*N); z = zeros(1,N);
for l=0:L-1
ws(l+1,:) = [z,cos(l*2*pi*n/N),z];
end
alpha = [0.42,0.5,0.08]; % Classic Blackman
w = alpha * ws;
19 20
Classic Blackman Window and Transform Three-Term Blackman-Harris
1
Classic Blackman Window: M = 51 Properties:
0.8
• α0 = 0.4243801 α1 = 0.4973406, and
Amplitude
0.6
α2 = 0.0782793.
0.4
0.2
• Side-lobe level 71.48 dB.
0
20 40 60 80 100 120 140
• Side lobes roll off ≈ 6dB per octave in the absence of
Time (samples)
aliasing (like rectangular and Hamming).
0
• All degrees of freedom (scaling aside) are used to
−20
minimize side lobes (like Hamming).
Magnitude (dB)
−40
−60
−80
Matlab:
−100
−120
100 200 300 400 500 600 700 800 900 1000
N = 101; L = 3; No2 = (N-1)/2; n=-No2:No2;
Frequency (bins)
ws = zeros(L,3*N); z = zeros(1,N);
for l=0:L-1
ws(l+1,:) = [z,cos(l*2*pi*n/N),z];
end
% 3-term Blackman-Harris(-Nuttall):
alpha = [0.4243801, 0.4973406, 0.0782793];
w = alpha * ws;
21 22
0.8 0.8
Amplitude
Amplitude
0.6 0.6
0.4 0.4
0.2 0.2
0 0
20 40 60 80 100 120 140 100 200 300 400 500 600 700 800 900
Time (samples) Time (samples)
0 0
−20 −20
Magnitude (dB)
Magnitude (dB)
−40 −40
−60 −60
−80 −80
−100 −100
−120 −120
100 200 300 400 500 600 700 800 900 1000 200 400 600 800 1000 1200 1400 1600
Frequency (bins) Frequency (bins)
23 24
Power-of-Cosine Miscellaneous Windows
πn Bartlett (“Triangular”)
L M −1 M −1
w(n) = wR (n) cos , n∈ − ,
M 2 2
|n|
• L = 0, 1, 2, . . . w(n) = wR (n) 1 −
(M − 1)/2
• first L terms of its Taylor expansion, evaluated at the
endpoints are identically 0 • Convolution of two half-length rectangular windows
• roll-off rate ≈ 6(L + 1)dB/octave • Window transform is sinc2 =⇒
• L = 0 ⇒ Rectangular window • First sidelobe twice as far down as rect (-26 dB)
• L = 1 ⇒ MLT sine window • Main lobe twice as wide as that of a rectangular
• L = 2 ⇒ Hann window (“raised cosine” = “cos ”) 2 window having the same length
(same as that of a half-length rect used to make it)
• L = 3 ⇒ Alternate Blackman (max roll-off rate)
• Often applied to sample correlations of finite data
L
Thus, cos windows parametrize Lth-order • Also called the “tent function”
Blackman-Harris windows configured so as to use all L
degrees of freedom to maximize roll-off rate.
25 26
Poisson (“Exponential”)
∞
X
HP (z) = [w(n)h(n)]z −n
n=0
|n|
−α (M −1)/2 ∞ h
wP (n) = wR(n)e X αn
− M/2
i
∆ α
M
= h(n)e z −n (let r = e M/2 )
where: α determines the time constant ( τ = 2α ) n=0
∞
X ∞
X
1
Poisson Window M = 51 = h(n)z −nr−n = h(n)(zr)−n
n=0 n=0
0.9
0.8 alpha = 1
= H(zr)
0.7
0.6
Amplitude
0.5
z - plane
0.4
0.3
0.2 alpha = 10
0.1
0
-20 -10 0 10 20
time (samples)
r 1
27 28
Hann-Poisson (“No Sidelobes”) Hann-Poisson Window and Transform
1 n −α
|n| 1
Amplitude
0.6
(gradient-based)
−10
Magnitude (dB)
Matlab: −20
−30
function [w,h,p] = hannpoisson(M,alpha) PSfrag replacements
%HANNPOISSON - Length M Hann-Poisson window −40
−3 −2 −1 0 1 2 3
ωT (radians per sample)
29 30
Hann-Poisson Slope and Curvature Slope and Curvature for Larger Alpha
Slope and Curvature of DTFT dB Magnitude, Hann−Poisson Window, M = 21, Alpha = 2.0 Slope and Curvature of DTFT dB Magnitude, Hann−Poisson Window, M = 21, Alpha = 3.0
0.03 0.02
0.02
dB Magnitude Slope
dB Magnitude Slope
0.01
0.01
0 0
−0.01
−0.01
−0.02
−0.03 −0.02
−4 −3 −2 −1 0 1 2 3 4 −4 −3 −2 −1 0 1 2 3 4
ωT (radians per sample) ωT (radians per sample)
−5 −5
x 10 x 10
5 2
dB Magnitude Curvature
dB Magnitude Curvature
−2
31 32
Kaiser r !
2
M ωk
sinh β2 − 2
Question: How do we use all M degrees of freedom M
W (ωk ) = r
(sample values) in an M -point window w(n) to obtain I0(β)
M ωk
2
W (ω) ≈ δ(ω) in some optimal sense? β2 − 2
The Kaiser window maximizes the energy in the main where I0 is a Bessel function of the first kind, and is
lobe of the window. equal to
∞ 2
∆
X (x/2)k
main lobe energy
I0(x) =
max k!
k=0
w total energy ∞
X (x/2)k
The functions which maximize this ratio are known as (Compare this with ex/2 = .)
k!
prolate spheroidal wave functions. k=0
Note: Sometimes you see the Kaiser window
Kaiser discovered an approximation based upon Bessel ∆
functions: parameterized by α where β = πα
r 2
!
I0 β 1− M/2
n
∆
wK (n) = I0 (β) , − M2−1 ≤ n ≤ M2−1
0, elsewhere
33 34
−20
β = [0, 2, 4, 6, 8, 10]
−30 Length 50 Kaiser windows, 6 betas between 0 and 10
1.2
−40
Side Lobe Level (SLL)
β=0
−50
1
−60
−70 0.8
−80 β=2 β = 10
Amplitude
−90 0.6
α = 4.0
−100
1 1.5 2 2.5 3 3.5 4 4.5
Main lobe width in units of rectangular−window main−lobe widths
0.4
β=4
• β is equal to 1/2 ‘time-bandwidth product’ 0.2
35 36
β = [0, 2, 4, 6, 8, 10] M = [20, 30, 40, 50]
Length 50 Kaiser windows, 6 betas between 0 and 10 Kaiser window transforms, 4 window lengths between 20 and 50, beta=4
0 0
β=0
dB
−50 −20 M = 20
dB
−100 −40
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
0
Normalized Frequency (cycles per sample) β=2 −60
0 0.05 0.1 0.15 0.2 0.25
dB
−50
0 Normalized Frequency (cycles per sample)
−100
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 −20 M = 30
0
β=4
dB
Normalized Frequency (cycles per sample)
−40
dB
−50
−100 −60
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0 0.05 0.1 0.15 0.2 0.25
0 Normalized Frequency (cycles per sample)
Normalized Frequency (cycles per sample) β=6 0
dB
−50
−20 M = 40
dB
−100
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 −40
0
Normalized Frequency (cycles per sample) β=8
−60
dB
dB
dB
−50 −40
−100 −60
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0 0.05 0.1 0.15 0.2 0.25
Normalized Frequency (cycles per sample) Normalized Frequency (cycles per sample)
37 38
1 0
Alternatively, minimize main lobe width subject to a
α=1 α=1 sidelobe spec:
Magnitude (dB)
Amplitude
0.5 −50
max(ωc)
w |W (ω) |≤ cα , ∀|ω|≥ωc
0 −100
−50 0
Time (samples)
50 −2 0 2
ωT (radians per sample) Closed-Form Window Transform:
cos M cos−1 β cos πk
1 0
α=2 α=2 M
Magnitude (dB)
W (ωk ) = , (|k| ≤ M − 1)
Amplitude
cosh M cosh−1(β)
0.5 −50
1
0 −100 β = cosh cosh−1(10α) , (α ≈ 2, 3, 4)
−50 0
Time (samples)
50 −2 0 2
ωT (radians per sample)
M
[Note error in text, which says “β = cosh−1[· · · ]”]
1 0
α=3 α=3
Magnitude (dB)
Amplitude
0.5 −50
• Window w = IDFT(W ) [zero-phase case]
eplacements or IDFT of (−1)k W (ωk ) for causal case
0 −100
−50 0 50 −2 0 2
Time (samples) ωT (radians per sample) • α controls sidelobe level (“stopband ripple”):
Side-Lobe Level in dB = −20α.
• smaller ripple ⇒ larger ωc
• see matlab function “chebwin(M,ripple)”
• also called the Dolph-Chebyshev Window
39 40
Chebyshev Window, Length 31, Ripple -40 dB Chebyshev Window, Length 31, Ripple -200 dB
0.8 0.8
Amplitude
Amplitude
0.6 0.6
0.4 0.4
0.2 0.2
0 0
−25 −20 −15 −10 −5 0 5 10 15 20 25 −25 −20 −15 −10 −5 0 5 10 15 20 25
Time (samples) Time (samples)
10 0
0 −50
Magnitude (dB)
−10
Magnitude (dB)
−100
−20
−150
−30
rip = 200.0 dB
rip = 40.0 dB −200
−40
−250
−50
−60 −300
−0.5 −0.4 −0.3 −0.2 −0.1 0 0.1 0.2 0.3 0.4 0.5 −0.5 −0.4 −0.3 −0.2 −0.1 0 0.1 0.2 0.3 0.4 0.5
Normalized Frequency (cycles/sample) Normalized Frequency (cycles/sample)
41 42
Chebyshev Window, Length 101, Ripple -40 dB Chebyshev and Hamming Windows Compared
Length 101 Chebyshev window DFT of Chebyshev and Hamming Window: M = 31, Ripple = −42 dB
1 0
0.8
Chebyshev
Hamming
−10
Amplitude
0.6
0.4
−20
0.2
−30
Magnitude (dB)
0
−60 −40 −20 0 20 40 60
Time (samples)
−40
10
0
−50
−10
Magnitude (dB)
−20
−30 −60
rip = 40.0 dB
−40
−50 −70
−60
PSfrag replacements
−0.5 −0.4 −0.3 −0.2 −0.1 0 0.1 0.2 0.3 0.4 0.5
−3 −2 −1 0 1 2 3
Normalized Frequency (cycles/sample)
ωT (radians per sample) Normalized Frequency (rad/sample)
43 44
Gaussian The Gaussian Window in Spectral Modeling
The Gaussian “bell curve” is the only smooth function Special Property: On a dB scale, the Gaussian is
that transforms to itself: quadratic ⇒ parabolic interpolation of a sampled
1 2 2 2 2 Gaussian transform is exact.
√ e−t /2σ ↔ e−ω /2(1/σ)
σ 2π Conjecture: Quadratic interpolation of spectral peaks
It also achieves the minimum time-bandwidth product is generally more accurate on a log-magnitude scale (e.g.,
dB) than on a linear magnitude scale. This has been
σtσω = σ × (1/σ) = 1 verified in a number of cases, and no counter-examples
when “width” of a function is defined as the square root are yet known. Exercise: Prove this is true for the
of its second central moment. For even functions w(t), rectangular window.
sZ
∞
∆
σt = t2w(t)dt.
−∞
Matlab for the Gaussian Window
• Since the true Gaussian function has infinite duration,
in practice we must window it with some finite
window, or at least truncate it. function [w] = gausswin(M,sigma)
45 46
1
Gaussian Window, M = 21, Sigma = M/8 Generally we desire
0.8 W (ω) ≈ δ(ω)
Amplitude
0.6
0.4
• Best results are obtained by formulating this as an
0.2
FIR filter design problem.
0
−20 −15 −10 −5 0 5 10 15 20
• In general, both time-domain and frequency-domain
Time (samples)
specifications are needed.
0
DTFT
Parabola
• Equivalently, both magnitude and phase
−20
specifications are necessary in the frequency domain.
Magnitude (dB)
−40
−60
−80
eplacements
−100
−3 −2 −1 0 1 2 3
ωT (radians per sample)
47 48
Optimal Windows for Audio Coding Conclusion
Windows in Graphics
1
http://www.cg.tuwien.ac.at/studentwork/CESCG99/TTheussl/paper.html
49 50