回声信号的产生与消除

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

M=4001;

fs=8000;

[B,A]=cheby2(4,20,[0.1 0.7]);

Hd=dfilt.df2t([zeros(1,6) B],A);

hFVT=fvtool(Hd);

set(hFVT,'Color',[1 1 1])

H=filter(Hd,log(0.99*rand(1,M)+0.01).*sign(randn(1,M)).*exp(-0.002*(1:M))); H=H/norm(H)*4;

plot(0:1/fs:0.5,H);

xlabel('Time[sec]');

ylabel('Amplitude');

title('Room Impulse Response');

set(gcf,'Color',[1 1 1]);

load nearspeech

n=1:length(v);

t=n/fs;

plot(t,v);

axis([0 33.5 -1 1]);

xlabel('Time[sec]');

ylabel('Amplitude');

title('Near-End Speech Signal');

set(gcf,'Color',[1 1 1 ]);

p8=audioplayer(v,fs);

playblocking(p8);

load farspeech

x=x(1:length(x));

dhat=filter(H,1,x);

plot(t,dhat);

axis([0 33.5 -1 1]);

xlabel('Time[sec]');

ylabel('Amplitude');

title('Far-End Echoed Speech Signal');

set(gcf,'Color',[1 1 1]);

p8=audioplayer(dhat,fs);

playblocking(p8);

d=dhat+v+0.001*randn(length(v),1);

plot(t,d);

axis([0 33.5 -1 1]);

xlabel('Time[sec]');

ylabel('Amplitude');

title('Microphone Signal');

set(gcf,'Color',[1 1 1 ]);

p8=audioplayer(d,fs);

playblocking(p8);

mu=0.025;

W0=zeros(1,2048);

del=0.01;

lam=0.98;

x=x(1:length(W0)*floor(length(x)/length(W0)));

d=d(1:length(W0)*floor(length(d)/length(W0)));

hFDAF=adaptfilt.fdaf(2048,mu,1,del,lam);

[y,e]=filter(hFDAF,x,d);

n=1:length(e);

t=n/fs;

pos=get(gcf,'Position');

set(gcf,'Position',[pos(1),pos(2)-100,pos(3),(pos(4)+85)]); subplot(3,1,1)

plot(t,v(n),'g');

axis([0 33.5 -1 1]);

xlabel('Time[sec]');

ylabel('Amplitude');

title('Near-End Speech Signal');

subplot(3,1,2)

plot(t,d(n),'b');

axis([0 33.5 -1 1]);

xlabel('Time[sec]');

ylabel('Amplitude');

title('Microphone Signal');

subplot(3,1,3)

plot(t,e(n),'r');

axis([0 33.5 -1 1]);

xlabel('Time[sec]');

ylabel('Amplitude');

title('Output of Acoustic Echo Canceller');

set(gcf,'Color',[1 1 1])

p8=audioplayer(e/max(abs(e)),fs);

playblocking(p8);

相关文档
最新文档