Digital Signal Processing Reference
In-Depth Information
it outputs logic 0. Finally, the logic operation at the last stage decodes the key information based on the
7-bit binary pattern.
Program 8.21. DTMF detection using the Goertzel algorithm.
close all;clear all;
% DTMF tone generator
N ¼ 205;
fs ¼ 8000; t ¼ [0:1:N-1]/fs;
% Sampling rate and time vector
x ¼ zeros(1,length(t));x(1) ¼ 1;
% Generate the impulse function
%Generation of tones
y697 ¼ filter([0 sin(2*pi*697/fs)],[1 -2*cos(2*pi*697/fs) 1],x);
y770 ¼ filter([0 sin(2*pi*770/fs)],[1 -2*cos(2*pi*770/fs) 1],x);
y852 ¼ filter([0 sin(2*pi*852/fs)],[1 -2*cos(2*pi*852/fs) 1],x);
y941 ¼ filter([0 sin(2*pi*941/fs)],[1 -2*cos(2*pi*941/fs) 1],x);
y1209 ¼ filter([0 sin(2*pi*1209/fs) ],[1 -2*cos(2*pi*1209/fs) 1],x);
y1336 ¼ filter([0 sin(2*pi*1336/fs)],[1 -2*cos(2*pi*1336/fs) 1],x);
y1477 ¼ filter([0 sin(2*pi*1477/fs)],[1 -2*cos(2*pi*1477/fs) 1],x);
key ¼ input( ' input of the following keys: 1,2,3,4,5,6,7,8,9,*,0,# ¼ > ' , ' s ' );
yDTMF ¼ [];
if key ¼¼ ' 1 '
yDTMF ¼ y697 þ y1209; end
if key ¼¼ ' 2 '
yDTMF ¼ y697 þ y1336; end
if key ¼¼ ' 3 '
yDTMF ¼ y697 þ y1477; end
if key
¼¼ '
4
yDTMF
¼
y770
þ
y1209; end
'
(a)
2000
1500
1000
500
0
0
500
1000
1500
2000
2500
3000
3500
4000
Frequency (Hz)
(b)
1.5
1
0.5
0
0
500
1000
1500
2000
2500
3000
3500
4000
Frequency (Hz)
FIGURE 8.56
(a) Goertzel filter bank frequency responses; (b) display of spectral values and threshold for key 7.
 
Search WWH ::




Custom Search