tomwalters@0: % method of class @signal tomwalters@0: % tomwalters@0: % INPUT VALUES: tomwalters@0: % tomwalters@0: % RETURN VALUE: 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 tomwalters@0: tomwalters@0: function val=gettimevalue(sig,times) tomwalters@0: % usage: val=gettimevalue(sig,time) tomwalters@0: % returns the value at this point in time tomwalters@0: tomwalters@0: val=zeros(size(times)); tomwalters@0: if isempty(times) tomwalters@0: return tomwalters@0: end tomwalters@0: tomwalters@0: sr=1/getsr(sig); tomwalters@0: tomwalters@0: threshold=sr/100; tomwalters@0: nr_points=getnrpoints(sig); tomwalters@0: start=getminimumtime(sig); tomwalters@0: stop=getmaximumtime(sig); tomwalters@0: x=start+sr:sr:stop; tomwalters@0: Y=sig.werte; tomwalters@0: method='linear'; tomwalters@0: tomwalters@0: tomwalters@0: for ii=1:length(times); tomwalters@0: time=times(ii)-sig.start_time; tomwalters@0: tomwalters@0: nrint=round(time/sr); tomwalters@0: rint=time/sr; tomwalters@0: tomwalters@0: if (nrint-rint)0 && nrint <= length(sig.werte) tomwalters@0: val(ii)=sig.werte(nrint); tomwalters@0: end tomwalters@0: else tomwalters@0: xi=times(ii); tomwalters@0: val(ii)=interp1(x,Y,xi,method); tomwalters@0: end tomwalters@0: end tomwalters@0: tomwalters@0: