DTFM decoding using goertzel algorithm and peak-picking
Show older comments
Sorry for what will be a lengthy question. I am working on a project that will decode an array of DTMF tones. These tones can be of variable length as can the pauses between them. I am having trouble figuring out how to analyze the output of the goertzel function to distinguish between the different key strokes.
Here is what I have so far, I am sure their is a more elegant way to do it but I am just trying to get it to work before streamlining it.
First I generate the 7 DTMF frequencies using this function:
% Sinusoid.m
% Generates a sinudoid of frequency omega_0, sampled at a frequency of
% omega_s, for a duration of dur seconds.
function [x,t] = sinusoid(omega_0,dur,omega_s)
ts= (1)/(omega_s);
n = [0:fix(dur/ts)];
t = n.*ts;
x = sin(omega_0*t);
[x1] = sinusoid(697*pit,.25,8000*pit);
[x2] = sinusoid(770*pit,.25,8000*pit);
[x3] = sinusoid(852*pit,.25,8000*pit);
[x4] = sinusoid(941*pit,.25,8000*pit);
[y1] = sinusoid(1209*pit,.25,8000*pit);
[y2] = sinusoid(1336*pit,.25,8000*pit);
[y3] = sinusoid(1477*pit,.25,8000*pit);
[pause,t] = sinusoid(0,.25,8000*pit);
Next I sum the appropriate frequency pairs:
one = x1+y1;
two = x1+y2;
three = x1+y3;
four = x2+y1;
five = x2+y2;
six = x2+y3;
seven = x3+y1;
eight = x3+y2;
nine = x3+y3;
star = x4+y1;
zero = x4+y2;
pound = x4+y3;
Finally I create the array:
array = [eight pause eight pause eight pause four pause three pause eight pause six pause four pause three pause eight pause]; %888 438 6438
Then I run it through the my decoding function which is still a work in progress:
% phone.m
% Takes an array of DTMF tones and decodes it into a phone number.
function [phoneNum] = phone(array)
digitIndex = find(array); % locates the non-zero indices
start = 1; % Initializing start and stop which will act at the limits of
stop = 1; % individual tones.
x = 1;
for k = 1:length(digitIndex)-1
if digitIndex(k) ~= digitIndex(k+1)- 1
% if the values of digitIndex are non-sequential it indicates a
% break has occured due to a pause.
stop = k; % Sets end of array equal to break point.
tone = array(start:start+127);
start = digitIndex(k+2); % updates start to begining of next digit.
TONE = goertzel(tone); % takes DFT of digit using goertzel algorithm
subplot(4,3,x)
stem(abs(TONE))
title (x)
axis([-10,210,0,100])
x = x + 1;
end
end
I can see that the numbers have unique characteristics so I know I am gathering the data. I just do not know how to do a peak picking algorithm that will result in the frequency pairs and allow for decoding.
I appreciate everyones time in helping out.
Accepted Answer
More Answers (0)
Categories
Find more on Quantizers in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!