Description Part 1 : FIR Filter Designs

Objectives : - analyze digital audio signal with some added noise
                    - identify the noise signals and eliminate them using non real time digital filtering techniques in Matlab
                    - design the lowpass FIR filters using Matlab

Equipments : orig1.wav and noisy1.wav files , Matlab software .

Procedure :

Exploratory Data Analysis

1) Wave files provided is collected. (Odd ID wave file : orig1.wav and noisy1.wav )
2) Matlab software is used to analyze the wave files provided. Analysis is based on both time and spectral domain.Example of Matlab code used to analysed the time and frequency domain of audio signals is as shown in lab sheet.
3) The example codes(follow this link for the example code) given is studied and applied it in Matlab to perform the time and frequency analysis for the given orig1.wav and noisy1.wav files. The plots generated using Matlab on the time and frequency domain analysis is shown to instructor.

Design and Implementation of lowpass FIR filters

1) There are 4 specifications of FIR lowpass filter that is observed ,

Note  that practically , a transition band frequency (fs-fp) exist for any pratical lowpass filter.

2) The "fir1" command is studied.The argument Wn in fir1 function is representing normalized frequency, its relation is as shown below. Cutoff frequency fc is determined. ( fT is the sampling frequency )

Wn = 2*pi*fc / pi*fT = ( fp + fs ) / fT

3) Argument N in the fir1 function represents the length( number of impulse) of the lowpass filter. Longer N gives better filtering effects ( better attenuation and passband gain ) however it needs more computation. This experiment requirement to be achieved is a passband gain | Gp | < 3 dB and stopband attenuation |Gs| > 20 dB. The minimum length N that can be used to obtain a lowpass FIR filter that fullfills the passband and the stopband specifications is determined.
4)The FIR filter is designed using fir1 function in Matlab. The designed filter frequency responses(magnitude and phase) is plotted to check for specifications requirement. The filter coefficients is saved when the designed filter met the requirements, otherwise redesign with other parameters. The impulse response is plotted using stem function.
5)The noise is removed using the the designed filter by the filter( ) Matlab function. For example if the noisy signal is stored in vector x and the designed FIR filter coefficients are stored on the vector h then the filtered signal is obtained by

y = filter ( h,1,x )
6)The effectiveness of the designed filter is evaluated by computing the MSE(mean squared error) and SNR(signals to noise ratio) between the original signal and the filter noisy signal. The MSE and SNR is defined this way :

where s(n) is original signal , y(n) is the filtered signal sample and M is the total number of samples. A Matlab code is wrote to compute the MSE and SNR. The original and filtered signal is plotted on the same figure both time and frequency domains.Filtered signals is saved in a ".wav" file format  for evaluation.
7)In DSP chip , a coefficients is usually represented using a finite number of bits, eg : 8 bit DSP chip. A matlab program is wrote to quantize the coefficients of the designed filter into 4 bit , 8 bit , 12 bit and 16 bit. The quantization program basically performed the following computation :
Bk = [ bk*2N-1 + 0.5 ] / 2N-1
where |_._| is the floor operator , N is the number of bits , bk and Bk are the unquantized and quantized filter coefficicents respectively.
8) The effectiveness of the design with quantized coefficients is evaluated by computing the MSEand SNR between the original and filtered version of the noisy signal. Both the original and the filtered signal is plotted on the same figure for both time and frequency domains.