annotate _misc/featureextraction/.svn/text-base/beatchroma.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 = beatchroma(chromag, beats, frame_t)
matthiasm@8 2
matthiasm@8 3 % assigning beats to frames
matthiasm@8 4 nBeat = length(beats);
matthiasm@8 5 nFrame = size(chromag, 2);
matthiasm@8 6 beatassign = zeros(1,nFrame);
matthiasm@8 7 iBeat = 1;
matthiasm@8 8
matthiasm@8 9 for iFrame = 1:nFrame
matthiasm@8 10 if frame_t(iFrame) > beats(iBeat) && frame_t(iFrame) < beats(end)
matthiasm@8 11 iBeat = iBeat + 1;
matthiasm@8 12 end
matthiasm@8 13 beatassign(iFrame) = iBeat;
matthiasm@8 14 end
matthiasm@8 15 % averaging over frames belonging to one beat
matthiasm@8 16 fprintf(1,'__ preprocessing chromagram... ___________________________________________\n');
matthiasm@8 17 bc = zeros(nBeat,12);
matthiasm@8 18 chromag(:,isnan(sum(chromag))) = 1;
matthiasm@8 19
matthiasm@8 20 for iBeat = 1:nBeat
matthiasm@8 21 bc(iBeat,:) = median(chromag(:,beatassign == iBeat),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