Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > Общие вопросы по .NET и C# > Расщифровка DTMF сигнала.


Автор: xwx 27.5.2008, 16:51
Здравствуйте может кто с таким сталкивался нужна прога для распознование DFMF сигнала тоесть когда я подключаю телефон к аудио входу комьпьютера и на удаленной трубке нажымаю на какие-то клавишы прога бы их понимала...У меня имеются пару примеров но они несовсем рабочии...

Автор: xwx 29.5.2008, 10:15
Вот кстати код для расшифровки DTMF сигнала трудно ли его переписать на C#?

Код

function digitstr = dtmfd(encstr)
% This function translates the encoded tones to corresponding
% keys/key that are pressed.
% Example digitstr = dtmfd(vec)
% Where vec is the vector that contains the encoded tones
%
% Shiladitya Sircar 2002
% DSP Course Project
global dtmf_rfreq
global dtmf_cfreq
global dtmf_fs
global dtmf_silencelen
global dtmf_tonelen
global dtmf_key
% Can use the setparameter function in order to just evaluate this function
% to do this just un-comment the setparameter. This script will set up the global
%variable required to execute dtmf encoding.
%setparameter;
% Length of Band Pass Filter
% If the bandpass is too wide, this can be increased to produce a more narrow filter
% for finer precision. However computation time increases a value L = 64 gives
% satisfactory results for no noise environment
L = 64;
filt_n = 0:L-1;
dtmf_digilen = length(encstr)/(dtmf_tonelen+dtmf_silencelen);
for deco_seq = 1:dtmf_digilen
% Loop through each row and Check if the row-i frequency exist in the signal
% Define the pointer at start of the sequence
startpos = (deco_seq - 1)*(dtmf_tonelen + dtmf_silencelen) + 1;
endpos = startpos + dtmf_tonelen - 1;
encstr_frag = encstr(startpos:endpos);
for i = 1:4
% Calculate filter coefficients for the bandpass filter for row frequencies
% given the center frequency
hh = 2/L*cos(2*pi*dtmf_rfreq(i)*filt_n/dtmf_fs);
ss = mean(conv(encstr_frag,hh).^2) > mean(encstr_frag.^2)/5;% compare mean amplitude and if
% more than 20% ( /5 ), the frequency
% component is considered to be strong
if (ss)
row = i;
break % we already have our row - no need to check the rest
end
end
% Loop through each column and check if the column-i frequency exist in the signal
for i = 1:4
% Calculate filter coefficients for the bandpass filter for column frequencies
% given the center frequency
hh = 2/L*cos(2*pi*dtmf_cfreq(i)*filt_n/dtmf_fs);
ss = mean(conv(encstr_frag,hh).^2) > mean(encstr_frag.^2)/5;
if (ss)
col = i;
9
break % we already have our column - no need to check the rest
end
end
numstr(1,deco_seq) = dtmf_key(row,col);
end
digitstr = numstr;

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)