Pitch.Class
Pitch classes.
In the naming scheme, f
stands for flat (♭) and s
is for sharp (♯).
type t = [
|
`Cff
C♭♭
*)|
`Cf
C♭
*)|
`C
C
*)|
`Cs
C♯
*)|
`Css
C♯♯
*)|
`Dff
D♭♭
*)|
`Df
D♭
*)|
`D
D
*)|
`Ds
D♯
*)|
`Dss
D♯♯
*)|
`Eff
E♭♭
*)|
`Ef
E♭
*)|
`E
E
*)|
`Es
E♯
*)|
`Ess
E♯♯
*)|
`Fff
F♭♭
*)|
`Ff
F♭
*)|
`F
F
*)|
`Fs
F♯
*)|
`Fss
F♯♯
*)|
`Gff
G♭♭
*)|
`Gf
G♭
*)|
`G
G
*)|
`Gs
G♯
*)|
`Gss
G♯♯
*)|
`Aff
F♭♭
*)|
`Af
A♭
*)|
`A
A
*)|
`As
A♯
*)|
`Ass
A♯♯
*)|
`Bff
B♭♭
*)|
`Bf
B♭
*)|
`B
B
*)|
`Bs
B♯
*)|
`Bss
B♯♯
*) ]
The type for pitch classes. The representation is not unique, for example Css
(C♯♯) and D
are the same pitch class.
val to_int : t -> int
to_int c
is c
as an integer on a non-modular semitone scale. `C
is 0, `Cff
is -2
and `Bss
is 13
. See also to_mod_int
.
val to_mod_int : t -> int
XXX. Should the default equal
and compare
be the modular one ?
equal c0 c1
is true
iff to_int c0 = to_int c1
. Note that this does not equate enharmonics like `C
and `Bs
, use mod_equal
for that.
compare c0 c1
orders c0
and c1
according to to_int
. Note that this does not equate enharmonics like `C
and `Bs
, use mod_compare
for that.
mod_equal c0 c1
is true
iff c0
and c1
represent the same pitch class. Equates enharmonics like `C
and `Bs
.
mod_compare c0 c1
is a total order on pitches compatible with mod_equal
.
val pp : Stdlib.Format.formatter -> t -> unit
pp
formats pitch classes. Uses the Unicode ♭ and ♯ characters.