view matlab/shift_beat.m @ 56:fa819cf73ea7

Improved introduction, removed 1st para after section indent.
author samer
date Fri, 16 Mar 2012 18:05:17 +0000
parents 6464cf684717
children 69b54aa5a9bb
line wrap: on
line source
function X=shift_beat(delta,X)		
	beatpos=X(:,4);
	if any(diff(beatpos)<0)
		disp('WARNING: metrical position not monotonic');
		figure(70); 
		times=(X(:,1)-X(1,1))/1000;
		Kick=find(X(:,2)==1);
		Snare=find(X(:,2)==2);
		plot(flatten([times';times']),flatten(X(:,[8,7])'));
	%	[times,,X(:,[7,8]));
		hold on;
		stem(times(Kick),X(Kick,6),'ro');
		stem(times(Snare),X(Snare,6),'gx');
		hold off;
		xlim([0,30]);
		pan on;
	end
	X(:,4)=beatpos+delta;
end