annotate toolboxes/MIRtoolbox1.3.2/AuditoryToolbox/CorrelogramMovie.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function movie = CorrelogramMovie(data, sr, frameRate, width)
wolffd@0 2 % function movie = CorrelogramMovie(data, sr, frameRate, width)
wolffd@0 3 % Compute a Matlab movie of a sound array called "data" which has
wolffd@0 4 % a sampling rate of sr Hz. Compute frameRate frames per second, each
wolffd@0 5 % time taking "width" samples for analysis.
wolffd@0 6
wolffd@0 7 % (c) 1998 Interval Research Corporation
wolffd@0 8
wolffd@0 9 if nargin < 2, sr = 16000; end
wolffd@0 10 if nargin < 3, frameRate = 12; end
wolffd@0 11 if nargin < 4, width = 256; end
wolffd@0 12
wolffd@0 13 [channels, len] = size(data);
wolffd@0 14 frameIncrement = fix(sr/frameRate);
wolffd@0 15 frameCount = floor((len-width)/frameIncrement)+1;
wolffd@0 16
wolffd@0 17 movie = moviein(frameCount);
wolffd@0 18 for i=1:frameCount
wolffd@0 19 start = (i-1)*frameIncrement + 1;
wolffd@0 20 pic = CorrelogramFrame(data, width, start, frameIncrement*2);
wolffd@0 21 minimum = min(min(pic));
wolffd@0 22 maximum = max(max(pic));
wolffd@0 23 image((pic-minimum)/(maximum-minimum)*length(colormap));
wolffd@0 24 drawnow;
wolffd@0 25 movie(:,i) = getframe;
wolffd@0 26 end