Music.Prim
Music primitives.
type 'a t = [
|
`Note of dur * 'a
Interpret note for given duration.
`Rest of dur
Rest for given duration.
]
The type for music primitives. Either a note of type 'a or a rest (silence).
'a
val note : dur -> 'a -> 'a t
note d n is `Note (d, n), interprets note n for duration d.
note d n
`Note (d, n)
n
d
val rest : dur -> 'a t
rest d is `Rest d, rests for duration d.
rest d
`Rest d
val dur : 'a t -> dur
dur p is p's duration in whole notes units.
dur p
p
val map : ('a -> 'b) -> 'a t -> 'b t
map f p maps the note of p with f.
map f p
f
val map_dur : (dur -> dur) -> 'a t -> 'a t
map_dur f p maps duration of p with f.
map_dur f p
val fold : note:(dur -> 'a -> 'b) -> rest:(dur -> 'b) -> 'a t -> 'b
fold ~note ~rest p folds over p with note and rest.
fold ~note ~rest p
note
rest