180 likes | 291 Views
EE513 Audio Signals and Systems. Digital Signal Processing (Synthesis) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky. Filters. Filter are designed based on specifications given by: spectral magnitude emphasis
E N D
EE513Audio Signals and Systems Digital Signal Processing (Synthesis) Kevin D. DonohueElectrical and Computer EngineeringUniversity of Kentucky
Filters Filter are designed based on specifications given by: • spectral magnitude emphasis • delay and phase properties through the group delay and phase spectrum • implementation and computational structures Matlab functions for filter design • (IIR) besself, butter, cheby1, cheby2, ellip, prony, stmcb • (FIR) fir1, fir2, kaiserord, firls, firpm, firpmord, fircls, fircls1, cremez • (Implementation) filter, filtfilt, dfilt • (Analysis) freqz, FDAtool, SPtool
Filter Specifications Example:Low-pass filter frequency response
Filter Specifications Example Low-pass filter frequency response (in dB)
Filter Specifications Example Low-pass filter frequency response (in dB) with ripple in both bands
Filter Specification Functions The transfer function magnitude or magnitude response: The transfer function phase or phase response: The group delay (envelope delay) :
Filter Analysis Example Consider a filter with transfer function: Compute and plot the magnitude response, phase response, and group delay. Note pole-zero diagram. What would be expected for the magnitude response?
Basic Filter Design The following commands generate filter coefficients for basic low-pass, high-pass, band-pass, band-stop filters: • For linear phase FIR filters: fir1 • For non-linear phase IIR filter: besself, butter, cheby1, cheby2, ellip Example: With function fir1, design an FIR high-pass filter for signal sampled at 8 kHz with cutoff at 500 Hz. Use order 10 and order 50 and compare phase and magnitude spectra with freqz command. Use grpdelay to examine delay properties of the filter. Also use command filter to filter a frequency swept signal from 20 to 2000 Hz over 4 seconds with unit amplitude.
Basic Filter Design Example: With function cheby2 design an IIR Chebyshev Type II high-pass filter for signal sampled at 8 kHz with cutoff at 500 Hz, and stopband ripple of 30 dB down. Use order 5 and order 10 for comparing phase and magnitude spectra with freqz command. Use grpdelay to examine delay characteristics. Also use command filter to filter a frequency swept signal from 20 to 2000 Hz over 2 seconds with unit amplitude. Example: With function butter, design an IIR Butterworth band-pass filter for signal sampled at 20 MHz with with a sharp passband from 3.5 MHz to 9MHz. Use order 5 and verify design of phase and magnitude spectra with freqz command. Also use command filter and filtfilt to filter an ultrasonic signal received from a medical imaging probe.
filtfilt => Zero Phase Filtering Consider and N point signal x(n) and filter impulse response h(n) Convolve sequences to obtain w(n) and reverse the order of w(n) Convolve w(N-n) with h(n) and reverse results to obtain y(n) Note the effective filter of x(n) is , which has zero phase and the magnitude of .
Filter Design with Spectral Magnitude Criteria The following commands generate filter coefficients for an arbitrary filter shape or impulse response. • For linear phase FIR filters: fir2, firls • The frequency points are specified with a vector containing the normalized frequency axis and a corresponding vector indicating the amplitude at each of those points. • For non-linear phase IIR filter: prony, stmcb • The filter is specified in terms an impulse response and the IIR filter model (numerator and denominator order specified) is fitted to the response to minimize mean square error of the impulse response.
Basic Filter Design Example: Record a voice repeating random speech for about 20 seconds at fs = 22050 Hz, and compute its average spectrum. From the picture of the average spectrum magnitude, determine a spectral shape vector for use with function fir2 to create a filter that approximates the voice spectrum. Add white noise to another voice signal from the same person to achieve a 6dB SNR and use filter to see how well the noise can be reduced with the filter you designed. Example: Generate an approximate impulse response of a room and record it with fs=11025 Hz. Use the prony function to attempt to model the room distortion as an IIR filter (you have to guess some the orders and test to see if it works).
Exercise Example Record room noise (or another interesting noise process ) for about 10 seconds at fs= 8000 Hz, and compute its average spectrum (use the pwelch function). From the picture of the average spectrum magnitude, determine a spectral shape vector for use with function fir2 to create a filter that matches the noise spectrum. Filter a white noise sequence with the FIR filter you designed and compare the sound to white noise before and after filtering with the room noise filter. Briefly describe your observations, comment on differences and similarities.
Useful Filter Functions The sinc function and the rectangular pulse form a Fourier transform pair. Sketch these functions and label the null points of the sinc function. • What would a shift of the rect function in frequency do to the sinc function in the time domain? • What would a shift of the sinc function in time do to the rect function in the frequency domain?
Useful Filter Functions The sinc function and the rectangular pulse form a Fourier transform pair. Sketch these function and label the null points of the sinc function. What would a shift of the rect function in time do to the sinc function in the frequency domain?
Ideal Low-Pass Filter The rect function in the frequency domain represents the ideal low-pass filter. If the ideal low-pass filter were implemented in the time domain, what would the convolution kernel look like? Comment on the causality of this filter. This is the filter that is required to perfectly reconstruct a bandlimited signal (sampled above its Nyquist rate) from its samples.
Ideal Interpolation Function If the rect function in the frequency domain has B/2 equal to the Nyquist frequency. Then the time domain sinc nulls fall on sampling increments and the following convolution becomes the reconstruction or interpolation filter to restore a sampled band-limited signal from its samples: where T = 1/B.