Digital Sound & Music: Concepts, Applications, & Science, Chapter 2, last updated 6/25/2013
Figure 2.51 Discontinuity between the end of a window and its beginning
In the output of the FFT, the discontinuity between the ends and the beginnings of the
windows manifests itself as frequency components that don't really exist in audio – called
spurious frequencies, or spectral leakage. You can see the spectral leakage Figure 2.41.
Although the audio signal actually contains only one frequency at 880 Hz, the frequency analysis
view indicates that there is a small amount of other frequencies across the audible spectrum.
In order to smooth over this discontinuity and thereby reduce the amount of spectral
leakage, the windowing functions effectively taper the ends of the segments to 0 so that they
connect from beginning to end. The drop-down menu to the left of the FFT size menu in
Audition is where you choose the windowing function. In Figure 2.50, the Hanning function is
chosen. Four commonly-used windowing functions are given in the table below.
triangular windowing function
[ ( )]
Hanning windowing function
Hamming windowing function
( ) ( )
Blackman windowing function
t is time.
T is length of period. If w is window size and sr is sampling rate, then
Figure 2.52 Windowing functions
Windowing functions are easy to apply. The segment of audio data being transformed is
simply multiplied by the windowing function before the transform is applied. In MATLAB, you
can accomplish this with vector multiplication, as shown in the commands below.
y = wavread('HornsE04Mono.wav');
sr = 44100; %sampling rate
w = 2048; %window size
T = w/sr; %period
% t is an array of times at which the sine function is evaluated
t = linspace(0, 1, 44100);
twindow = t(1:2048); %first 2048 elements of t
% Create the values for the hamming function, stored in vector called hamming
hamming = 0.54 - 0.46 * cos((2 * pi * twindow)/T);