No BSD License  

Highlights from
DTMF Encoder/Decoder with GUI using FFT,goertzel,Filter Banks

image thumbnail

DTMF Encoder/Decoder with GUI using FFT,goertzel,Filter Banks

by

 

A phone-like DTMF Encoding/Decoding tool

update_gui_bank.m
%   Update_gui_bank : The main routine called when a event happens in gui
%   update_gui_bank
%   If myfilter==1 then ,
%   
%       
%       Input :
%       signal  : to DTMF signal.
%       
%
%       Output:
%                   Updates the gui (with myiirnotch Filter , Complement Notch IIR)...
%
%   
%   elseif algo==0,
%       Input :
%       signal  : to DTMF signal.
%       
%
%       Output:
%                   Updates the gui(with filters designed with SPTOOL toolbox)...
%       
%   end   
%   Copyright 2005 (R)
%   Author : Zouzias Anastasios
%   Email : zouzias@ceid.upatras.gr
%   $Date: 2005/08/31 18:03:00 $


%============================================
%============================================
%     Initialization 
%============================================
%============================================

fs=8192; 

pad=['1' '2' '3' ; '4' '5' '6' ; '7' '8' '9'; '*' '0' '#'];


%============================================
%============================================
%      
%============================================
%============================================




%============================================
%============================================
%       Filter Selection
%============================================
%============================================

if myfilter==1,
  
f1=697;
f2=770;
f3=852;
f4=941;
f5=1209;
f6=1336;
f7=1477;

    
    
    
    
 [b1,a1]=myiirnotch(f1,f1/35,fs);
 [b2,a2]=myiirnotch(f2,f2/35,fs);
 [b3,a3]=myiirnotch(f3,f3/35,fs);
 [b4,a4]=myiirnotch(f4,f4/35,fs);
 [b5,a5]=myiirnotch(f5,f5/35,fs);
 [b6,a6]=myiirnotch(f6,f6/35,fs);
 [b7,a7]=myiirnotch(f7,f7/35,fs);
    
    
    
yfilt1=filter(b1,a1,signal);
yfilt2=filter(b2,a2,signal);
yfilt3=filter(b3,a3,signal);
yfilt4=filter(b4,a4,signal);
yfilt5=filter(b5,a5,signal);
yfilt6=filter(b6,a6,signal);
yfilt7=filter(b7,a7,signal);
    
    
%============================================
%============================================   
else,
    
    

% Loads the bank from disk...

 if ~exist('filt1') || ~exist('filt2') || ~exist('filt3') || ~exist('filt4') || ~exist('filt5') || ~exist('filt6') || ~exist('filt7') ,
       load filter_bank.mat
end


%============================================
%============================================
%      Pass the signal from The FILTER BANK.
%============================================
%============================================





yfilt1=conv(filt1.tf.num,signal);
yfilt2=conv(filt2.tf.num,signal);
yfilt3=conv(filt3.tf.num,signal);
yfilt4=conv(filt4.tf.num,signal);
yfilt5=conv(filt5.tf.num,signal);
yfilt6=conv(filt6.tf.num,signal);
yfilt7=conv(filt7.tf.num,signal);



end











%================================================================
%================================================================
%      Find the energy from every output and find the max
%================================================================
%================================================================

energy=[norm(yfilt1) norm(yfilt2) norm(yfilt3) norm(yfilt4) norm(yfilt5) norm(yfilt6) norm(yfilt7)]';

position=[find(energy==max(energy(1:4))) find(energy==max(energy(5:7)))-4]';


digit=pad(position(1,1),position(2,1));

% Update the key press EditBox
set(handles.EditPressed,'String',num2str(digit(1,1)) );

temp=sprintf('---> Key Pressed is %c',digit);

disp(temp)




%================================================================
%================================================================
%      Find the energy from every output and find the max
%================================================================
%================================================================

set(handles.energy1,'String',num2str(energy(1,1)) );

set(handles.energy2,'String',num2str(energy(2,1)) );

set(handles.energy3,'String',num2str(energy(3,1)) );

set(handles.energy4,'String',num2str(energy(4,1)) );

set(handles.energy5,'String',num2str(energy(5,1)) );

set(handles.energy6,'String',num2str(energy(6,1)) );

set(handles.energy7,'String',num2str(energy(7,1)) );




Contact us