tomwalters@0: % method of class @signal tomwalters@0: % function sig=generateirn(sig,delay,g,niter) tomwalters@0: % INPUT VALUES: tomwalters@0: % sig: original @signal with length and samplerate tomwalters@0: % delay: delay, after which the noise is added again tomwalters@0: % g: gain tomwalters@0: % niter: number of iterations that are added tomwalters@0: % tomwalters@0: % RETURN VALUE: tomwalters@0: % sig: @signal tomwalters@0: % bleeck@3: % This external file is included as part of the 'aim-mat' distribution package bleeck@3: % (c) 2011, University of Southampton bleeck@3: % Maintained by Stefan Bleeck (bleeck@gmail.com) bleeck@3: % download of current version is on the soundsoftware site: bleeck@3: % http://code.soundsoftware.ac.uk/projects/aimmat bleeck@3: % documentation and everything is on http://www.acousticscale.org bleeck@3: tomwalters@0: tomwalters@0: function sig=generateirn(sig,delay,g,niter) tomwalters@0: tomwalters@0: srate=getsr(sig); tomwalters@0: dur=getlength(sig); tomwalters@0: tomwalters@0: dels=round(delay*srate); tomwalters@0: npts=round(dur*srate); tomwalters@0: tomwalters@0: nois=randn(size(1:npts)); tomwalters@0: tomwalters@0: for i=1:niter; tomwalters@0: dnois=nois; tomwalters@0: dnoist=dnois(1:dels); tomwalters@0: dnois=[dnois dnoist]; tomwalters@0: dnois=dnois(dels+1:npts+dels); tomwalters@0: dnois=dnois.*g; tomwalters@0: nois=nois+dnois; tomwalters@0: end; tomwalters@0: tomwalters@0: rms=sqrt(mean(nois.*nois)); tomwalters@0: b=nois./rms; tomwalters@0: tomwalters@0: sig=setvalues(sig,b);