Professional Documents
Culture Documents
html
1 of 3
Close Window
Contents
Generating DTMF Tones
Playing DTMF Tones
Estimating DTMF Tones with the Goertzel Algorithm
Detecting DTMF Tones
697 Hz
770 Hz
852 Hz
941 Hz
1209 Hz
1336 Hz
1477 Hz
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
|
ABC
|
DEF
|
|
1
|
2
|
3
|
|_ _ _ _ __ _ _ _ __ _ _ _ _
|
|
|
|
GHI
|
JKL
|
MNO
|
|
4
|
5
|
6
|
|_ _ _ _ __ _ _ _ __ _ _ _ _
|
|
|
|
PRS
|
TUV
|
WXY
|
|
7
|
8
|
9
|
|_ _ _ _ __ _ _ _ __ _ _ _ _
|
|
|
|
|
|
|
|
*
|
0
|
#
|
|_ _ _ _ __ _ _ _ __ _ _ _ _
1209
1336
1477
1209
1336
1477
1209
1336
1477
1209
1336
1477
= 8000;
% Sampling frequency 8 kHz
800;
% Tones of 100 ms
= (0:N-1)/Fs; % 800 samples at Fs
= 2*pi*t;
tones = zeros(N,size(f,2));
for toneChoice=1:12,
% Generate tone
tones(:,toneChoice) = sum(sin(f(:,toneChoice)*pit))';
% Plot tone
subplot(4,3,toneChoice),plot(t*1e3,tones(:,toneChoice));
title(['Symbol "', symbol{toneChoice},'": [',num2str(f(1,toneChoice)),',',num2str(f(2,toneChoice)),']'])
set(gca, 'Xlim', [0 25]);
ylabel('Amplitude');
if toneChoice>9, xlabel('Time (ms)'); end
end
set(gcf, 'Color', [1 1 1], 'Position', [1 1 1280 1024])
annotation(gcf,'textbox', 'Position',[0.38 0.96 0.45 0.026],...
'EdgeColor',[1 1 1],...
'String', '\bf Time response of each tone of the telephone pad', ...
'FitHeightToText','on');
05/10/2014 19:23
2 of 3
% Original frequencies
original_f =
697
770
852
941
1209
1336
1477
k = round(original_f/Fs*Nt);
estim_f = round(k*Fs/Nt)
estim_f =
702
780
859
937
1210
1327
1483
To minimize the error between the original frequencies and the points at which the DFT is estimated, we truncate the tones, keeping only 205 samples or 25.6 ms for further processing.
tones = tones(1:205,:);
At this point we could use the Fast Fourier Transform (FFT) algorithm to calculate the DFT. However, the popularity of the Goertzel algorithm in this context lies in the small number of points at which
the DFT is estimated. In this case, the Goertzel algorithm is more efficient than the FFT algorithm.
Plot Goertzel's DFT magnitude estimate of each tone on a grid corresponding to the telephone pad.
figure,
for toneChoice=1:12,
% Select tone
05/10/2014 19:23
3 of 3
tone=tones(:,toneChoice);
% Estimate DFT using Goertzel
ydft(:,toneChoice) = goertzel(tone,k+1); % Goertzel use 1-based indexing
% Plot magnitude of the DFT
subplot(4,3,toneChoice),stem(estim_f,abs(ydft(:,toneChoice)));
title(['Symbol "', symbol{toneChoice},'": [',num2str(f(1,toneChoice)),',',num2str(f(2,toneChoice)),']'])
set(gca, 'XTick', estim_f, 'XTickLabel', estim_f, 'Xlim', [650 1550]);
ylabel('DFT Magnitude');
if toneChoice>9, xlabel('Frequency (Hz)'); end
end
set(gcf, 'Color', [1 1 1], 'Position', [1 1 1280 1024])
annotation(gcf,'textbox', 'Position',[0.28 0.96 0.45 0.026],...
'EdgeColor',[1 1 1],...
'String', '\bf Estimation of the frequencies contained in each tone of the telephone pad using Goertzel', ...
'FitHeightToText','on');
05/10/2014 19:23