-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmidi.m
61 lines (55 loc) · 913 Bytes
/
midi.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
Midi: module {
PATH : con "midi.dis";
# Meta events
SEQNUM,
TEXT,
COPYRIGHT,
TRACK,
INSTRUMENT,
LYRICS,
MARKER,
CUE: con iota;
EOT: con 16r2F; # End of Track
TEMPO: con 16r51;
# Control events;
NOTEOFF: con 16r8;
NOTEON: con 16r9;
AFTERTOUCH: con 16ra;
CONTROLLER: con 16rb;
PROGCHG: con 16rc;
CHANAFTERTOUCH: con 16rd;
PITCHBEND: con 16re;
Header: adt {
id: string;
length: int;
format: int;
numtracks: int;
division: int;
tpb: int; #tick per beat
istimecode : int;
tracks: array of ref Track;
};
Track: adt {
id: string;
length: int;
events: array of ref Event;
};
Event: adt {
delta: int;
pick {
Meta =>
etype: int;
data: array of byte;
Sysex =>
etype: int;
data: array of byte;
Control =>
etype: int;
mchannel: int;
param1: int;
param2: int;
}
};
init: fn();
read: fn(file:string): ref Header;
};