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

