CrazyEngineers Archive
Old, but evergreen and popular discussions on CrazyEngineers, presented to you in read-only mode.
@elektrolikit • 16 Jul, 2009
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 telecommunication signaling over analog telephone lines in the voice-frequency band between telephone handsets and other communications devices and the switching center. 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 Q.23. 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 https://www.muziknerede.com/touch.mat then just write
load touch
thats all, tones are ready to use at your enviroment)

😁
@Kaustubh Katdare • 16 Jul, 2009 Wow, this is awesome 😀
@Jojolucci • 26 Apr, 2014 Hi,

This code is very interesting. Can you tell me how you load your signal in the code? Also some explanations about it?
😀
@Jojolucci • 26 Apr, 2014 (My signal to add is a phone number sound.wav)
3.6k views

Related Posts

@Ankita Katdare · May 17, 2014

Nokia India has come up with a new low-budget smartphone with Nokia 225 priced at Rs. 3199. The phone weighs 99.8 g and has a 2.8 inch screen with QVGA...
1.2k views

@Ankita Katdare · Aug 7, 2013

Hyundai Motor India Ltd, India’s second largest passenger car manufacturer, has launched Hyundai Grand i10. Setting the small car market on fire, this new ride vehicle from Hyundai which happens...
4.8k views

@renu sharma · Jun 22, 2013

what is the difference between BJT and power BJT? what are the applications of each of them?
6.3k views

@Alok mishra · Feb 13, 2014

I am going to join CDAC at the end of this month and as i have never been to pune , i ask CEans to suggest me how and where...
1.2k views

@Ankita Katdare · Jan 7, 2011

Many of you will be appearing for GATE 2011. All with high aspirations for doing the M.Tech from a good college. To help others choose better, share your opinions on...
1.2k views