// http://www.cepstrum.co.jp/ // howling canceller simulation program for Scilab // // +-------------------------------------------------------------------+ // | | // | Gain s (quasi-white noise) | // | | | | // | v +---+ d v | // | +--->(x)--->| h +--->(+)---+ ds | // | | +---+ | | // | +---------+ | + v +-------+ | // +--->| limiter +---+ x ^ (+)---+--->| delay +---+ // +---------+ | | - ^ | e +-------+ ze // | +---+ | | // +---------->| w +----------+ | // +---+ y | // | | // +-----------------+ clear; // clear all variables //Gain=2.0; // maximum gain of acoustic system //MU =0.003; // step size parameter of adaptive filter Gain=1000.0; // maximum gain of acoustic system MU =0.000000003; // step size parameter of adaptive filter DATLEN=10000; FIRLEN=100; // adaptive filter legnth DLYLEN=100; // delay length // generate amplitude limited quasi-white noise rand('uniform'); indata=zeros(1:DATLEN); for i=1:DATLEN indata(i)=0.7*(sum(rand(1:20))-10.0)/10.0; end outdata=zeros(1:DATLEN); missalignment=zeros(1:DATLEN); err=zeros(1:DATLEN); // generate impulse response of acoustice system (h) rand('normal'); rand('seed', 5678); h=[zeros(1:5), rand(1:FIRLEN-5)]; h=h.*(0.96^(1:FIRLEN)); h=h/max(abs(fft([h, zeros(1:1000)], -1))); buf=zeros(1:FIRLEN); w=zeros(1:FIRLEN); delay=zeros(1:DLYLEN); ze=0; for i=1:DATLEN x=ze; // limiter if Gain