dtmfcut.m

来自「很多matlab的源代码」· M 代码 · 共 36 行

M
36
字号
function [nstart,nstop] = dtmfcut(xx,fs)%DTMFCUT   find the DTMF tones within x[n]%%  usage:%       indx = dtmfmain(xx,fs)%%   length of nstart = M = number of tones found%      nstart is the set of STARTING indices%      nstop is the set of ENDING indices%    xx = input signal vector%    fs = sampling frequency  %%  Looks for silence regions which must at least 10 millisecs long.%  Also the tones must be longer than 100 msecxx = xx(:)'/max(abs(xx));   %-- normalize xxLx = length(xx);Lz = round(0.01*fs);setpoint = 0.02;      %-- make everything below 2% zeroxx = filter( ones(1,Lz)/Lz, 1, abs(xx) );xx = diff(xx>setpoint);jkl = find(xx~=0)';%%%xx(jkl)if xx(jkl(1))<0, jkl = [1;jkl];  endif xx(jkl(end))>0, jkl = [jkl;Lx]; endjkl';indx = [];while length(jkl)>1	if jkl(2)>(jkl(1)+10*Lz)		indx = [indx, jkl(1:2)];	end	jkl(1:2) = [];endnstart = indx(1,:);nstop = indx(2,:);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?