tomwalters@0: % tool tomwalters@0: % tomwalters@0: % INPUT VALUES: tomwalters@0: % tomwalters@0: % RETURN VALUE: tomwalters@0: % tomwalters@0: % 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 cdat=coolregion(current_frame,cdat,peak) tomwalters@0: tomwalters@0: % Ich geh von einer Colormap aus, die Farben pro Wert zwischen 0 und 1 tomwalters@0: % unterschiedlich darstellt. 0=schwarz, und dann z.B zirkeln wie in prism tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: fre_val=peak.spektral_profile.position; tomwalters@0: int_val=peak.interval_profile.position; tomwalters@0: tomwalters@0: % current_frame_handle=peak.current_frame_handle; tomwalters@0: tomwalters@0: vals=getvalues(current_frame); tomwalters@0: % cdat=get(current_frame_handle,'cdata'); tomwalters@0: % erst mal alle erhaltenen Werte auf Null setzen tomwalters@0: ca=cdat; tomwalters@0: tomwalters@0: % wie weit die spektrale Summe runterskaliert werden muss, damit die Zahlen vernünftigt werden tomwalters@0: norm_spektralhight=1.5/1e5; tomwalters@0: fresumme=getfrequencysum(current_frame); tomwalters@0: fresumme=fresumme*norm_spektralhight; tomwalters@0: gauss=signal(fresumme); tomwalters@0: maxmaxpos=fre_val; tomwalters@0: maxmaxhight=1; tomwalters@0: sigma=peak.spektral_profile.sigma; tomwalters@0: gauss=generategauss(gauss,maxmaxpos,maxmaxhight,sigma); tomwalters@0: tomwalters@0: tomwalters@0: from_fre=fre_val-sigma; tomwalters@0: to_fre=fre_val+sigma; tomwalters@0: maxbin=length(cdat); tomwalters@0: minbin=1; tomwalters@0: maxchan=getnrchannels(current_frame); tomwalters@0: minchan=1; tomwalters@0: tomwalters@0: from_fre=min(from_fre,maxchan); tomwalters@0: from_fre=max(from_fre,minchan); tomwalters@0: to_fre=max(to_fre,minchan); tomwalters@0: to_fre=min(to_fre,maxchan); tomwalters@0: sr=getsr(current_frame); tomwalters@0: tomwalters@0: for i=from_fre:to_fre tomwalters@0: sig=getsinglechannel(current_frame,i); tomwalters@0: [maxpos,minpos,maxs,mins]=getminmax(sig); tomwalters@0: tomwalters@0: % Die Intervalle zwischen den Minima links und rechts vom Maximum werden eingefärbt tomwalters@0: from_int=getminimumleftof(int_val,maxpos,minpos,maxs,mins); tomwalters@0: to_int=getminimumrightof(int_val,maxpos,minpos,maxs,mins); tomwalters@0: % frombin=displaytime2bin(current_frame,from_int); tomwalters@0: % tobin=displaytime2bin(current_frame,to_int); tomwalters@0: frombin=time2bin(from_int,sr); tomwalters@0: tobin=time2bin(to_int,sr); tomwalters@0: frombin=min(frombin,maxbin); tomwalters@0: frombin=max(frombin,minbin); tomwalters@0: tobin=max(tobin,minbin); tomwalters@0: tobin=min(tobin,maxbin); tomwalters@0: tomwalters@0: tob=floor(maxbin-frombin); tomwalters@0: fromb=floor(maxbin-tobin+1); tomwalters@0: tomwalters@0: % ca(fromb:tob,i)=getbinvalue(gauss,i)*peak.spektralhight; tomwalters@0: ca(fromb:tob,i)=peak.source_color; tomwalters@0: % ca(fromb:tob,i)=floor(rand(1)*10); tomwalters@0: end tomwalters@0: tomwalters@0: cdat=ca;