Need help for DTMF Scoring fucntion
11 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have written a code for DTMF tone generation. Now for decodiing purpose, i have written code for dtmfscore
function ss = dtmfscor(xx, freq, L, fs)
if (nargin < 4), fs = 8000; end;
hh = (2/L)*cos(2*pi*freq*(0:L-1)/fs);
ss = (mean(conv(xx,hh).^2) > mean(xx.^2)/5);
the book says that input signal xx to dtmfscor function is actually a short segment from DTMF signal.The task of breaking up the signal so that each segment correspond to one key will be done by another function prior to calling dtmfscore.I m confused about xx. how to address this issue
Plz help me and give me rough skecth of algorithm I am stuck for last 2 days
0 Commenti
Risposta accettata
Wayne King
il 19 Ott 2011
I wouldn't write it like this because the dtmfscor function needs to know which column of tones it needs. But if you call the following:
>>[tones,ss] = dtmfking;
function [tones,ss] = dtmfking
lfg = [697 770 852 941]; % Low frequency group
hfg = [1209 1336 1477]; % High frequency group
% construct table of frequencies
f = [];
for c=1:4,
for r=1:3,
f = [ f [lfg(c);hfg(r)] ];
end
end
Fs = 8000; % Sampling frequency 8 kHz
N = 800; % Tones of 100 ms
t = (0:N-1)/Fs; % 800 samples at Fs
pit = 2*pi*t;
tones = zeros(N,size(f,12));
for toneChoice=1:12,
% Generate tone
tones(:,toneChoice) = sum(sin(f(:,toneChoice)*pit))';
end
ss = dtmfscor(tones,697,20,8000);
%Here i am giving the first freq and first column to cross check
function ss = dtmfscor(tones, freq, L, fs)
if (nargin < 4), fs = 8000; end;
hh = (2/L)*cos(2*pi*freq*(0:L-1)/fs);
ss = (mean(conv(tones(:,1),hh).^2) > mean(tones(:,1).^2)/5);
end
end
0 Commenti
Più risposte (10)
Wayne King
il 19 Ott 2011
I'm assuming xx is the output of your other function as you have stated.
It of course doesn't have to be called xx, xx is just a place holder in your function definition. Then you just feed that output to dtmfscor().
What exactly do you mean you're confused about xx?
0 Commenti
moonman
il 19 Ott 2011
2 Commenti
Wayne King
il 19 Ott 2011
It sounds like he is saying to segment your signal, parse your signal so that each segment corresponds to key only. Then you pass that part to your dtmfscor() function which detects which key was passed. You want to make sure the signal you pass contains only one key so that you can make the correct decision.
Have you looked at:
>>dtmfdemo
and the doc example for goertzel
Wayne King
il 19 Ott 2011
Can't you do something like this
function tones = dtmfseg
lfg = [697 770 852 941]; % Low frequency group
hfg = [1209 1336 1477]; % High frequency group
% construct table of frequencies
f = [];
for c=1:4,
for r=1:3,
f = [ f [lfg(c);hfg(r)] ];
end
end
Fs = 8000; % Sampling frequency 8 kHz
N = 800; % Tones of 100 ms
t = (0:N-1)/Fs; % 800 samples at Fs
pit = 2*pi*t;
tones = zeros(N,size(f,12));
for toneChoice=1:12,
% Generate tone
tones(:,toneChoice) = sum(sin(f(:,toneChoice)*pit))';
end
end
>>tones = dtmfseg;
gives you the output array tones, which is a matrix where each column is a tone (including * and #).
Then each column of the matrix is one of your xx to use with your detection algorithm.
Obviously you can adjust the length as you wish.
0 Commenti
Wayne King
il 19 Ott 2011
Hi Moonman, here is a modification that outputs only one tone:
function tone = dtmfseg(symb)
symbol = {'1','2','3','4','5','6','7','8','9','*','0','#'};
[truefalse,toneChoice] = ismember(symb,symbol);
if truefalse
lfg = [697 770 852 941]; % Low frequency group
hfg = [1209 1336 1477]; % High frequency group
% construct table of frequencies
f = [];
for c=1:4,
for r=1:3,
f = [ f [lfg(c);hfg(r)] ];
end
end
Fs = 8000; % Sampling frequency 8 kHz
N = 800; % Tones of 100 ms
t = (0:N-1)/Fs; % 800 samples at Fs
pit = 2*pi*t;
tone = sum(sin(f(:,toneChoice)*pit))';
else
error('Your input is invalid');
end
end
You would call it like this (for example):
>>tone = dtmfseg('2');
0 Commenti
Vedere anche
Categorie
Scopri di più su DTMF in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!