annotate toolboxes/MIRtoolbox1.3.2/AuditoryToolbox/CorrelogramArray.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 = CorrelogramArray(data, sr, frameRate, width)
wolffd@0 2 % function movie = CorrelogramArray(data, sr, frameRate, width)
wolffd@0 3 % Compute an array of correlogram frames, from the sound file data with
wolffd@0 4 % a sampling rate of sr Hz. Compute frameRate frames per second, using
wolffd@0 5 % a window size of "width" samples.
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 fprintf('Correlogram spacing is %g samples per frame.\n', frameIncrement);
wolffd@0 17
wolffd@0 18 movie = zeros(channels*width, frameCount);
wolffd@0 19 for i=1:frameCount
wolffd@0 20 start = (i-1)*frameIncrement + 1;
wolffd@0 21 pic = CorrelogramFrame(data, width, start, frameIncrement*4);
wolffd@0 22 minimum = min(min(pic));
wolffd@0 23 maximum = max(max(pic));
wolffd@0 24 image((pic-minimum)/(maximum-minimum)*length(colormap));
wolffd@0 25 drawnow;
wolffd@0 26 movie(:,i) = reshape(pic, channels*width, 1);
wolffd@0 27 end