Music 320 lab 5
November 2, 2000

5. direct convolution, FIR design

discussion: filtering in the frequency domain
   extremely important result: convolution theorem
      convolution in time <-> (pointwise) multiplication in frequency
      multiplication in time <-> convolution in frequency
         (example of simple ring modulation)

   intuition about the way a filter's frequency response modifies an input
   suggests that filtering may be well implemented in the frequency domain
   matlab: freqz

   sidebar: direct convolution
      signal samples <-> filter coefficients
      any signal may be used to filter another
         output is the intersecting frequencies of the two signals
	 time-smearing as a typical feature of direct convolution
	    long filters imply radical reshaping of transients
      commonly used as a cross-synthesis technique
      reverberation as a particular application
         convolving the recorded impulse response of a room with signal
	    to reverberate
	 impulse response recorded with sharp transient (ideally, a loud 
	    single-sample click, in practice a long burst of white noise)
	 Worldwide Soundspaces web site
 	    http://orpheus.tamu.edu/fredrics/isrc.html

   filter design: window method

      virtues: relatively easy to understand, works for any order of filter
      disadvantages: not optimal by any definition
         for one sort of optimality with relatively short filters, use remez 
	    (Parks-McClellan, Jim McClellan as a DSP First author)
	    numerical analysis method

      procedure:
         generally more interested in the frequency characteristics of a filter
            than the time-domain characteristics
         hence, begin by specifying a frequency response
	 the ideal filter has perfectly sharp transition regions (boxcar)
	 transforming a boxcar into the time domain gives an infinite-length
            sinc function
         unfortunately, a practical filter can't be infinite length
	 hence, we truncate the coefficients in some way: windowing
            [windowing is a crucial tool in all sorts of spectrum analysis]
         truncation as the simplest window: multiplying by a boxcar
	 recall that time-domain multiplication is frequency-domain convolution
            so the time-domain boxcar convolves our ideal frequency response
	       with a sinc function
	       [Matlab example: sidelobes]
	    our ideal filter becomes a practical filter, with imperfect 
	       pass- and stopbands, and a transition region

      improving the results:
         higher-order filter will suffer less from the results of truncation
	    [Matlab example]
         other windows reduce sidelobe energy at expense of mainlobe width
            hamming, hanning, blackman family, etc.
            [Matlab example]
         kaiser window as a family: allows us to choose main/side tradeoff
	    [Matlab example]

      useful matlab functions: fir1, remez