tomwalters@0: % tool tomwalters@0: % tomwalters@0: % INPUT VALUES: tomwalters@0: % tomwalters@0: % RETURN VALUE: tomwalters@0: % 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 ampscale=filterbandamp(fre,amp,fc,df1,bw,df2) tomwalters@0: % usage: ampscale=filterbandamp(fre,amp,fc,df1,bw,df2) tomwalters@0: % given a frequency and its associated amplitude, and the defining properties of tomwalters@0: % a bandpass filter (cf. Krumbholz et al (2000), JASA 108, 1170-1180, Fig.3) tomwalters@0: % this function returns the amplitude of the frequency component after it has tomwalters@0: % passed through the filter. The reurned amplitude should be used to SCALE the tomwalters@0: % amplitude of the given frequency component. tomwalters@0: % fre frequency in Hz tomwalters@0: % amp amplitude tomwalters@0: % fc lower cutoff frequency tomwalters@0: % df1 lower spectral ramp width tomwalters@0: % bw bandwidth (of plateau) tomwalters@0: % df2 upper spectral ramp tomwalters@0: % tomwalters@0: % David Smith (16/05/02) tomwalters@0: tomwalters@0: if (fre<(fc-df1)) | (fre>(fc+bw+df2)) tomwalters@0: ampscale=0; %ignore everything outside passband tomwalters@0: elseif fre<=fc %lower spectral ramp tomwalters@0: ampscale=max(cos((fc-fre)*pi/(2*df1)),0); %quarter-cycle of cosine function tomwalters@0: elseif fre<=fc+bw %flat part of filter tomwalters@0: ampscale=1; tomwalters@0: else %upper spectral ramp tomwalters@0: ampscale=max(cos((fre-(fc+bw))*pi/(2*df2)),0); tomwalters@0: end