Академический Документы
Профессиональный Документы
Культура Документы
telephony to dial numbers and configure switchboards. It is also used in systems such as in voice mail, electronic mail and telephone banking.
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
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', ... 'FitBoxToText','on');
The minimum duration of a DTMF signal defined by the ITU standard is 40 ms. Therefore, there are at most 0.04 x 8000 = 320 samples available for estimation and detection. The DTMF decoder needs to estimate the frequencies contained in these short signals. One common approach to this estimation problem is to compute the Discrete-Time Fourier Transform (DFT) samples close to the seven fundamental tones. For a DFT-based solution, it has been shown that using 205 samples in the frequency domain minimizes the error between the original frequencies and the points at which the DFT is estimated.
Nt = 205; original_f = [lfg(:);hfg(:)] 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 % Indices of the DFT % Frequencies at which the DFT is estimated % Original frequencies
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 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', ... 'FitBoxToText','on');