MATLAB DTMF Decoding code

hi,

This is my DTMF decoding code for 7 number random dtmf signal.

What is Dtmf?
Dual-tone multi-frequency (DTMF) signaling is used for Signalling (Telecommunications) over analog telephone lines in the voice-frequency band between Telephone handsets and other communications devices and the Automatic Telephone Exchange. The version of DTMF used for telephone tone dialing is known by the trademarked term Touch-Tone (canceled March 13, 1984), and is standardized by Itu T Recommendation #-Link-Snipped-#. It is also known in the UK as MF4. Other Multi Frequency systems are used for signaling internal to the telephone network.
(source:Wiki)

Code:
 
function [testout] = ttdecode2(x)
d = [0.7217 1.0247; 0.5346 0.9273; 0.5346  1.0247;0.5346 1.1328; 0.5906 0.9273;0.5906 1.0247; 0.5906 1.1328; 0.6535 0.9273;0.6535 1.0247; 0.6535 1.1328];
 
 aras = find(x==0);

 n = 1;
 for i = 1:size(aras,2)-2
if(aras(i+1)-aras(i) > 100)
if(aras(i+2)-aras(i+1) > 100)
abas(n,1)=aras(i);   
abas(n,2)=aras(i+2);
n = n + 1;    
aras(i+1)=aras(i+2);
i = i -1;
end
if(aras(i+2)-aras(i+1) < 100)
abas(n,1)=aras(i);
abas(n,2)=aras(i+1);
 n = n +1;
end
end
 end

x11 = x(abas(1,1):abas(1,2));
x12 = x(abas(2,1):abas(2,2));
x13 = x(abas(3,1):abas(3,2));
x14 = x(abas(4,1):abas(4,2));
x15 = x(abas(5,1):abas(5,2));
x16 = x(abas(6,1):abas(6,2));
x17 = x(aras(size(aras,2)):size(x,2));

bak1 = (abs(fft(x11,2048))).^2;
bak2 = (abs(fft(x12,2048))).^2;
bak3 = (abs(fft(x13,2048))).^2;
bak4 = (abs(fft(x14,2048))).^2;
bak5 = (abs(fft(x15,2048))).^2;
bak6 = (abs(fft(x16,2048))).^2;
bak7 = (abs(fft(x17,2048))).^2;
bak1(1000:2048)=0;
bak2(1000:2048)=0;
bak3(1000:2048)=0;
bak4(1000:2048)=0;
bak5(1000:2048)=0;
bak6(1000:2048)=0;
bak7(1000:2048)=0;
k = 0:2047;
omega = (2*pi*k)/2048;

frek(1,1)=omega(find(bak1==max(bak1)));
bak1(find(bak1==max(bak1)))=0;
frek(1,2)=omega(find(bak1==max(bak1)));
if(frek(1,1)>frek(1,2))
    c = frek(1,2);
frek(1,2)=frek(1,1);
frek(1,1) = c;
end

frek(2,1)=omega(find(bak2==max(bak2)));
bak2(find(bak2==max(bak2)))=0;
frek(2,2)=omega(find(bak2==max(bak2)));
if(frek(2,1)>frek(2,2))
    c = frek(2,2);
frek(2,2)=frek(2,1);
frek(2,1) = c;
end
this code takes the signal you give and after decode it, output the numbers.

This code is kuul because it can detect numbers from every 7 number dtmf signal.Tone and silence times are not important.

Totally my work.

enjoy it πŸ˜€

(Ps:If you want to test the code, you can download test tones directly from #-Link-Snipped-# then just write
load touch
thats all, tones are ready to use at your enviroment)

😁

Replies

  • Kaustubh Katdare
    Kaustubh Katdare
    Wow, this is awesome πŸ˜€
  • Jojolucci
    Jojolucci
    Hi,

    This code is very interesting. Can you tell me how you load your signal in the code? Also some explanations about it?
    πŸ˜€
  • Jojolucci
    Jojolucci
    (My signal to add is a phone number sound.wav)

You are reading an archived discussion.

Related Posts

Hello All I am wassup πŸ˜€ An ex electronics engineer, worked as an embedded engineer. Now cofounder and CEO of cleantech company ! And BIG K awesome work man !
Hi Ceans, Read the link the scientists have corrected the sensor problem!!πŸ˜› Scientists save India's moon mission from failure courtesy google news
Hello guys, Can anybody explain the need for isolating the oscilloscope? If not isolated what will happen? Explain in detail. Thanks in advance!
πŸ˜•Hey can anyone guide me as to what should be my future course of action,I have given my final semester exams from mumbai university & waiting for my results.My agg...
I know many of our CEan work in famouse MNC's and Firm. we know if we are working in an organization/Team/group then we require organizational behavioure. we know we require...