bleeck@3: % method of class @signal bleeck@3: % bleeck@3: % INPUT VALUES: bleeck@3: % sig,attenuation bleeck@3: % sig is the signal bleeck@3: % attenuation is the attenuation against the lowdest possible tone bleeck@3: % bleeck@3: % bleeck@3: % bleeck@3: % RETURN VALUE: bleeck@3: % bleeck@3: % 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: bleeck@3: bleeck@3: bleeck@3: bleeck@3: function sig=attenuate(sig,attenuation) bleeck@3: bleeck@3: if attenuation==0 bleeck@3: return bleeck@3: end bleeck@3: bleeck@3: dat=sig.werte; bleeck@3: ma=max(dat); bleeck@3: mi=min(dat); bleeck@3: if -mi > ma bleeck@3: ma=-mi; bleeck@3: end bleeck@3: amphigh=ma; bleeck@3: bleeck@3: amp=amphigh / power(10,-attenuation/20); bleeck@3: if amp>0 bleeck@3: sig=scaletomaxvalue(sig,amp); bleeck@3: end bleeck@3: