-
Notifications
You must be signed in to change notification settings - Fork 1
/
onset.m
29 lines (27 loc) · 804 Bytes
/
onset.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
function ob = onset(nmat,timetype)
% Onset times in beats or seconds
% ob = onset(nmat,<timetype>);
% Returns the onset times in beats or seconds of the notes in NMAT
%
% Input argument:
% NMAT = notematrix
% TIMETYPE (Optional) = timetype ('BEAT' (default) or SEC (Seconds).
%
% Output:
% OB = onset times in beats or seconds of notes in NMAT
%
% Date Time Prog Note
% 4.6.2002 18:36 TE Created under MATLAB 5.3 (Mac)
%© Part of the MIDI Toolbox, Copyright © 2004, University of Jyvaskyla, Finland
% See License.txt
if isempty(nmat), ob = []; return; end
if nargin<2, timetype='beat'; end
if strcmp(timetype, 'sec')
ob = nmat(:,6);
elseif strcmp(timetype, 'beat')
ob = nmat(:,1);
else
disp(['Unknown TIMETYPE option:''', timetype,''''])
disp(' =>''beat'' used instead')
ob = nmat(:,1);
end