matthiasm@8: function bc = synchronisechroma(chromag, beats, frame_t) matthiasm@8: matthiasm@8: % assigning beats to frames matthiasm@8: nBeat = length(beats); matthiasm@8: nFrame = size(chromag, 2); matthiasm@8: beatassign = zeros(nFrame,1); matthiasm@8: iBeat = 2; matthiasm@8: minFrame = find(frame_t > beats(1),1); matthiasm@8: matthiasm@8: bc = ones(nBeat,12); matthiasm@8: chromag(:,isnan(sum(chromag))) = 1; matthiasm@8: matthiasm@8: for iBeat = 1:nBeat-1 matthiasm@8: find() matthiasm@8: bc(iBeat,:) = median(chromag(:,beatassign == iBeat),2); matthiasm@8: if ~any(isnan(bc(iBeat,:))) matthiasm@8: bc(iBeat,:) = bc(iBeat,:)/max(bc(iBeat,:)); matthiasm@8: end matthiasm@8: end