tomwalters@0: % method of class @signal tomwalters@0: % function sig=genbandpassnoise(sig,varargin) tomwalters@0: % INPUT VALUES: tomwalters@0: % sig: @signal with length and samplerate 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=generateAMnoise(sig,fre,modgrad) tomwalters@0: tomwalters@0: len=getlength(sig); tomwalters@0: sr=getsr(sig); tomwalters@0: tomwalters@0: % generate white noise: tomwalters@0: vals=getvalues(sig); tomwalters@0: vals=rand(size(vals)).*2-1; tomwalters@0: sig=setvalues(sig,vals); tomwalters@0: tomwalters@0: envelope=generatesinus(sig,fre,1,0); tomwalters@0: envelope=(envelope+1)/2; tomwalters@0: tomwalters@0: sig=sig*envelope; tomwalters@0: tomwalters@0: tomwalters@0: sig=setname(sig,sprintf('AM noise Frequency %4.1f Hz',fre)); tomwalters@0: tomwalters@0: return