matlab wav分析,【求助】如何分析wav文件

icon1.gif

我用的是DTMF译码,不知道是否与你要求的一样.

function [telnum]=fft256_detDTMF(filename,dataN)

%**********************************************************************

%对波形文件进行256点FFT运算,并进行DTMF译码.

%telnum=fft256_detDTMF('telnum.wav',256);

%the result of telnum is:num

%取整函数:floor(向下取整) ceil (向上取整)

%参数:filename 波形文件名 dataN 数据长度

%*********************************************************************

N=256;

[wave,fs]=wavread(filename);

wav=[];

for k=1:dataN

wav=[wav wave(k)];

end

xf=fft(wav,N);

n=0:N-1;

stem(n*fs/N,abs(xf),'.');

xlabel(' fft frequency(Hz)','fontsize',12,'fontweight','bold');

axf=abs(xf);

max_f=pkpicker(axf,20,4); %求频率向量中最大幅度值

for n=1:length(axf)

if(axf(n)>=max_f(1)) k1=n;break;

end

end

for i=(k1+1):length(axf)

if(axf(i)>=max_f(2)) k2=i;break;

end

end

fl=floor(k1*fs/N); %求频率FL,FH

fh=floor(k2*fs/N);

if fl<=718

fl=718;

elseif fl<=812

fl=812;

elseif fl<=875

fl=875;

else

fl=968;

end

if fh<=1250

fh=1250;

elseif fh<=1375

fh=1375;

else

fh=1500;

end

switch fl %译码选择

case 718

hang=1;

case 812

hang=2;

case 875

hang=3;

case 968

hang=4;

otherwise

;

end

switch fh

case 1250

lie=1;

case 1375

lie=2;

case 1500

lie=3;

otherwise

;

end

switch hang

case 1

switch lie

case 1

num=1;

case 2

num=2;

case 3

num=3;

otherwise

;

end

case 2

switch lie

case 1

num=4;

case 2

num=5;

case 3

num=6;

otherwise

;

end

case 3

switch lie

case 1

num=7;

case 2

num=8;

case 3

num=9;

otherwise

;

end

case 4

switch lie

case 2

num=0;

otherwise

;

end

end

telnum=num;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值