Sign in

username:

password:



Not a member?

Search Online Books



Search tips

Free Online Books

Chapters

Chapter Contents:

Search Spectral Audio Signal Processing

  

Book Index | Global Index


Would you like to be notified by email when Julius Orion Smith III publishes a new entry into his blog?

  

The Rectangular Window

The (zero-centered) rectangular window may be defined by

$\displaystyle w_R(n) \isdef \left\{ \begin{array}{ll}
1, & -\frac{M-1}{2} \leq n \leq \frac{M-1}{2} \\
0, & \mbox{otherwise} \\
\end{array} \right.
$

where $ M$ is the window length in samples (assumed odd for now). A plot of the rectangular window appears in Fig.1.7 for length $ M=21$. It is sometimes convenient to define windows so that their dc gain is 1, in which case we would multiply the definition above by $ 1/M$.

Figure 1.7: The rectangular window.
\includegraphics[width=3.5in]{eps/rectWindow}

To see what happens in the frequency domain, we need to look at the DTFT of the window:

\begin{eqnarray*}
W_R(\omega )
& = & \hbox{\sc DTFT}_\omega(w_R) \isdef \sum_{...
...rac{M-1}{2}} - e^{-j \omega \frac{M+1}{2}} }{1 - e^{-j \omega }}
\end{eqnarray*}

where the last line was derived using the closed form of a geometric series:

$\displaystyle \sum_{n=L}^U r^n = \frac{ r^L - r^{U+1}}{1-r}
$

We can factor out linear phase terms from the numerator and denominator of the above expression to get
$\displaystyle W_R(\omega)$ $\displaystyle =$ $\displaystyle \frac{e^{-j \omega \frac{1}{2}}}{e^{-j\omega \frac{1}{2}}}
\left[...
...-j\omega\frac{M}{2}}}
{e^{j \omega\frac{1}{2}}-e^{-j\omega\frac{1}{2}}} \right]$  
  $\displaystyle =$ $\displaystyle \frac{\sin\left(M\frac{\omega}{2}\right)}{\sin\left(\frac{\omega}{2}\right)}
\isdef M\cdot \hbox{asinc}_M(\omega)
\protect$ (2.3)

where $ \hbox{asinc}_M(\omega)$ denotes the aliased sinc function:2.5

$\displaystyle \hbox{asinc}_M(\omega) \isdef \frac{\sin(M\omega/2)}{M\cdot \sin(\omega/2)} \protect$ (2.4)

(also called the Dirichlet function [159,62] or periodic sinc function). This (real) result is for the zero-centered rectangular window. For the causal case, a linear phase term appears:

$\displaystyle W^c_R(\omega) = e^{-j\frac{M-1}{2}\omega} \cdot M \cdot \hbox{asinc}_M(\omega)
$

The term ``aliased sinc function'' refers to the fact that it may be obtained from the sinc function sinc$ (\omega)=\sin(\omega)/\omega$ by aliasing sinc$ (\omega M/2)$ on a block of $ M$ samples. (In the time domain, an amplitude $ 1/M$ continuous rectangular pulse extending from time $ t=-M/2$ to $ t=M/2$ is simply sampled over the integers.)

As the sampling rate goes to infinity, the aliased sinc function therefore approaches the sinc function

sinc$\displaystyle (x) \isdef \frac{\sin(\pi x)}{\pi x}. \protect$ (2.5)

Specifically,

$\displaystyle \lim_{\stackrel{T\to 0}{MT=\tau}} \hbox{asinc}_M(\omega T) =$   sinc$\displaystyle (\tau f). \protect$ (2.6)

where $ \omega = 2\pi f$.2.6

Figure 1.8: Fourier transform of the rectangular window.
\includegraphics[width=\textwidth ,height=2.25in]{eps/rectWindowRawFT}

Figure 1.8 illustrates $ W_R(\omega) = M\cdot\hbox{asinc}_M(\omega)$ for $ M=11$. Note that this is the complete window transform, not just its real part. We obtain real window transforms like this only for zero-centered, symmetric windows. Note that the phase of rectangular-window transform $ W_R(\omega)$ is zero for $ \vert\omega\vert<2\pi/M$, which is the width of the main lobe. This is why zero-centered windows are often called zero-phase windows; while the phase actually alternates between 0 and $ \pi$ radians, the $ \pi$ values occur only within side-lobes which are routinely neglected (in fact, the window is normally designed to ensure that all side-lobes can be neglected).

More generally, we may plot both the magnitude and phase of the window versus frequency, as shown in Figures 1.9 and 1.10. In audio work, we more typically plot the window transform magnitude on a decibel (dB) scale, as shown in Fig.1.11. It is common to normalize the peak of the dB magnitude to 0 dB, as we have done here.

Figure 1.9: Magnitude of the rectangular-window Fourier transform.
\includegraphics[width=\textwidth ,height=2.75in]{eps/rectWindowFTzeroX}

Figure 1.10: Phase of the rectangular-window Fourier transform.
\includegraphics[width=\textwidth ,height=2.75in]{eps/rectWindowPhaseFT}

Figure 1.11: Magnitude (dB) of the rectangular-window transform.
\includegraphics[width=\textwidth ]{eps/rectWindowFT}



Subsections

Order a Hardcopy of Spectral Audio Signal Processing

Previous: Effect of Windowing
Next: Rectangular Window Side-Lobes

written by Julius Orion Smith III
Julius Smith's background is in electrical engineering (BS Rice 1975, PhD Stanford 1983). He is presently Professor of Music and Associate Professor (by courtesy) of Electrical Engineering at Stanford's Center for Computer Research in Music and Acoustics (CCRMA), teaching courses and pursuing research related to signal processing applied to music and audio systems. See http://ccrma.stanford.edu/~jos/ for details.


Comments


No comments yet for this page


Add a Comment
You need to login before you can post a comment (best way to prevent spam). ( Not a member? )