annotate _misc/featureextraction/.svn/text-base/synchronisechroma.m.svn-base @ 9:4ea6619cb3f5 tip

removed log files
author matthiasm
date Fri, 11 Apr 2014 15:55:11 +0100
parents b5b38998ef3b
children
rev   line source
matthiasm@8 1 function bc = synchronisechroma(chromag, beats, frame_t)
matthiasm@8 2
matthiasm@8 3 % assigning beats to frames
matthiasm@8 4 nBeat = size(beats,1);
matthiasm@8 5 nFrame = size(chromag, 2);
matthiasm@8 6
matthiasm@8 7 bc = ones(nBeat,size(chromag,1));
matthiasm@8 8 chromag(:,isnan(sum(chromag))) = 1;
matthiasm@8 9
matthiasm@8 10 if size(beats,2) < 2
matthiasm@8 11 for iBeat = 1:nBeat-1
matthiasm@8 12 currind = find(frame_t >= beats(iBeat) & frame_t < beats(iBeat+1));
matthiasm@8 13 bc(iBeat,:) = median(chromag(:,currind),2);
matthiasm@8 14 if ~any(isnan(bc(iBeat,:)))
matthiasm@8 15 bc(iBeat,:) = bc(iBeat,:)/max(bc(iBeat,:));
matthiasm@8 16 end
matthiasm@8 17 end
matthiasm@8 18 else
matthiasm@8 19 for iBeat = 1:nBeat
matthiasm@8 20 currind = (frame_t >= beats(iBeat,1) & frame_t < beats(iBeat,2));
matthiasm@8 21 bc(iBeat,:) = median(chromag(:,currind),2);
matthiasm@8 22 if ~any(isnan(bc(iBeat,:)))
matthiasm@8 23 bc(iBeat,:) = bc(iBeat,:)/max(bc(iBeat,:));
matthiasm@8 24 end
matthiasm@8 25 end
matthiasm@8 26 end