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