-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMusic.sig
51 lines (37 loc) · 1.02 KB
/
Music.sig
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
signature Music = sig
type pitch
val PITCH : char * int -> pitch
datatype accidental
= NATURAL of pitch
| SHARP of pitch
| FLAT of pitch
| DOUBLESHARP of pitch
| DOUBLEFLAT of pitch
datatype note
= REST
| NOTE of accidental
| CHORD of accidental list
datatype rhythm_unit
= WHOLE of note
| HALF of note
| QUARTER of note
| EIGHTH of note
| SIXTEENTH of note
| DOTTED of rhythm_unit
datatype rhythm
= RHYTHM of rhythm_unit
| TRIPLET of rhythm_unit * rhythm_unit * rhythm_unit
| TIE of rhythm_unit * rhythm
type meter
val METER : int * int -> meter
type tempo
val BPM : int -> tempo
type tempochange = tempo option
type measure
val MEASURE : tempochange * meter * rhythm list -> measure
type music
val SONG : tempo * measure list -> music
val bar_invariant : measure -> bool
val validate_song : music -> unit
val save_as_midi : string -> music -> word8 list
end