annotate 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
rev   line source
samer@20 1 function X=shift_beat(delta,X)
samer@56 2 beatpos=X(:,4);
samer@56 3 if any(diff(beatpos)<0)
samer@56 4 disp('WARNING: metrical position not monotonic');
samer@56 5 figure(70);
samer@56 6 times=(X(:,1)-X(1,1))/1000;
samer@56 7 Kick=find(X(:,2)==1);
samer@56 8 Snare=find(X(:,2)==2);
samer@56 9 plot(flatten([times';times']),flatten(X(:,[8,7])'));
samer@56 10 % [times,,X(:,[7,8]));
samer@56 11 hold on;
samer@56 12 stem(times(Kick),X(Kick,6),'ro');
samer@56 13 stem(times(Snare),X(Snare,6),'gx');
samer@56 14 hold off;
samer@56 15 xlim([0,30]);
samer@56 16 pan on;
samer@56 17 end
samer@56 18 X(:,4)=beatpos+delta;
samer@20 19 end
samer@20 20