100 6. REAL-TIME FILTERING
Also, note that as a result of coefficient quantization, the actual frequency response
O
H
e
j
would become different than the desired frequency response H
e
j
. For example,
for an FIR filter having N coefficients, it can be easily shown that the amount of error in the
magnitude of the frequency response,
ˇ
ˇ
H
e
j
ˇ
ˇ
, is bounded by
ˇ
ˇ
ˇ
H
e
j
ˇ
ˇ
ˇ
D
ˇ
ˇ
ˇ
H
e
j
O
H
e
j
ˇ
ˇ
ˇ
N 2
b
: (6.1)
6.5 REFERENCES
[1] J. Proakis and D. Manolakis, Digital Signal Processing: Principles, Algorithms, and Appli-
cations, Prentice Hall, 1996. 99
L6 LAB 6:
REAL-TIME FIR FILTERING, QUANTIZATION
EFFECT, AND OVERFLOW
e purpose of this lab is to design and then run an FIR filter written in C on the ARM proces-
sor of a smartphone. Also, the quantization effect and overflow are examined. e application
shells introduced in the previous labs are used here for collecting audio signal, passing a sampled
signal to a C code segment for filtering, and saving the output to a file for analysis. e design of
the FIR filter, i.e., generation of filter coefficients, is realized using the MATLAB filter design
tool. Other filter design tools may be used for the generation of filter coefficients. e lab ex-
periment involves the implementation of this filter in C code. e base application shell is used
here to insert the filtering C code. Note that the previous lab provided a floating-point C code
implementation of FIR filtering while the fixed-point C code implementation of FIR filtering
is covered here.
L6.1 FILTER DESIGN
To generate the filter coefficients, the Parks–McClellan method is used to design a lowpass filter
for the specifications stated below.
rpass = 0.1; %passband ripple
rstop = 20; %stopbad ripple
fs = 44100; %sampling frequency
f = [1600 2400]; %cutoff frequencies
a = [1 0]; %desired amplitudes
%compute deviations
dev = [(10^(rpass/20)-1)/(10^(rpass/20)+1) 10^(-rstop/20)];