tomwalters@0: % method of class @signal 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 t=getzerocrossings(signal,var) tomwalters@0: % gets the zero crossings of the signal. tomwalters@0: % in Case, the Signal has many zeros and only few tomwalters@0: % bumps, like in a klicktrain, only the last zero is counted tomwalters@0: % if var is there, then not real zero, but a value of var is taken tomwalters@0: tomwalters@0: if nargin < 2 tomwalters@0: var=0; tomwalters@0: end tomwalters@0: tomwalters@0: werte=getdata(signal); tomwalters@0: tomwalters@0: nr= getnrpoints(signal); % so many points tomwalters@0: a=0; tomwalters@0: count=1; tomwalters@0: sr=getSR(signal); tomwalters@0: for i=1:nr tomwalters@0: b=werte(i); tomwalters@0: if a <= var & b > var tomwalters@0: t(count)=bin2time(signal,i); tomwalters@0: count=count+1; tomwalters@0: end tomwalters@0: % shift the last values tomwalters@0: a=b; tomwalters@0: end