Mercurial > hg > cip2012
view matlab/shift_beat.m @ 57:ceec4e8b6585
Merge.
author | samer |
---|---|
date | Fri, 16 Mar 2012 18:05:56 +0000 |
parents | fa819cf73ea7 |
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