200 likes | 899 Views
FFT-based filtering and the Short-Time Fourier Transform (STFT). R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2003. Using the FFT for DSP.
E N D
FFT-based filteringand theShort-Time Fourier Transform (STFT) R.C. Maher ECEN4002/5002 DSP Laboratory Spring 2003
Using the FFT for DSP • Because the FFT provides the means to reduce the computational complexity of the DFT from order (N2) to order (N log2(N)), it is often desirable to do FFT-based processing for DSP systems • Even the computational cost of doing both FFT and IFFT may be less than conventional methods Fast Convolution and the STFT R. C. Maher
Convolution • FIR digital filter computes the linear convolution of the unit sample response with the input signal • A filter of length P requires P2 complexity • Recall that convolution in time domain is multiplication in frequency domain • So, consider multiplying signal and filter transforms in the frequency domain Fast Convolution and the STFT R. C. Maher
Circular Convolution • The DFT is a sampled version of the Fourier transform, so multiplying DFTs corresponds to circular convolution • Circular convolution can be thought of as “time-domain aliasing” • If we want linear convolution, we must ensure time-limited input signals to avoid time-domain aliasing (like bandlimiting to avoid frequency-domain aliasing) Fast Convolution and the STFT R. C. Maher
Linear convolution with the DFT • Consider a unit sample response h[n] with finite length P, and a signal x[n] of length L • Linear convolution h*x has length L+P-1 • To avoid time-domain aliasing, we zero pad both sequences to at least length L+P-1, do FFT, multiply the transforms, then IFFT to get L+P-1 result Fast Convolution and the STFT R. C. Maher
Overlap Processing • Now consider filter response of length P, but assume input signal is of arbitrarily long length: need to run filter “on the fly” as blocks of input data become available • Plan: break signal into consecutive blocks of length L, pad each with zeros to length L+P-1, and do FFT/multiply/IFFT Fast Convolution and the STFT R. C. Maher
Overlap algorithm • Note that the last P-1 output samples will overlap the start of the next block, and the overlapping points must be added to get the proper response. This is known as the overlap-add algorithm. Fast Convolution and the STFT R. C. Maher
Overlap-Add Process 0 L 2L 3L 4L x[n] h[n] y0[n]=h[n]*x0[n] y1[n]=h[n]*x1[n] y2[n]=h[n]*x2[n] y3[n]=h[n]*x3[n] Fast Convolution and the STFT R. C. Maher
Short-Time Fourier Transform • It is often desirable to have an estimate of the input signal spectrum for a “short” interval, especially for non-stationary signals. Want to see changes in spectrum with time. • The Fourier transform gives the frequency response, but it has infinite summation Fast Convolution and the STFT R. C. Maher
STFT (cont.) • Consider calculating a spectral “snapshot” by calculating Fourier transform of a short interval of the input signal w[n-m] x[n] Fast Convolution and the STFT R. C. Maher
STFT (cont.) • Express the short-time Fourier transform as a 2-dimensional signal • Multiplying signal by a short time function causes smeared spectrum: convolution of the transforms Fast Convolution and the STFT R. C. Maher
STFT viewpoints • Fourier transform viewpoint: group x[]·w[] • Take a sequence of DFTs as the window w[n-m] slides along the signal • Filter bank viewpoint: group x[n]e-jwn • Transform of w[n] is a low pass function • x[n]e-jwn is modulation: shifts spectrum of x[n] by w, where it can be filtered by low pass function Fast Convolution and the STFT R. C. Maher
STFT Reconstruction • With some restrictions, it is possible to do perfect reconstruction. STFT and inverse STFT are a transform pair. • Typically use overlapping window functions during analysis, then overlap-add during synthesis Fast Convolution and the STFT R. C. Maher
DSP Analysis/Process/Synthesis • Read in then next overlapping block of input samples • Apply analysis window • Perform FFT • Do frequency domain processing • Perform IFFT • Overlap-add into the output buffer Fast Convolution and the STFT R. C. Maher