Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
Spelling rules for common music notation.
- type Spelling_M i = i -> Maybe (Note_T, Alteration_T)
- pc_spell_natural_m :: Integral i => Spelling_M i
- pc_spell_natural :: Integral i => Spelling i
- pc_spell_ks :: Integral i => Spelling i
- pc_spell_sharp :: Integral i => Spelling i
- pc_spell_flat :: Integral i => Spelling i
Documentation
type Spelling_M i = i -> Maybe (Note_T, Alteration_T) Source
Variant of Spelling
for incomplete functions.
pc_spell_natural_m :: Integral i => Spelling_M i Source
Spelling for natural (♮) notes only.
map pc_spell_natural_m [0,1] == [Just (C,Natural),Nothing]
pc_spell_natural :: Integral i => Spelling i Source
Erroring variant of pc_spell_natural_m
.
map pc_spell_natural [0,5,7] == [(C,Natural),(F,Natural),(G,Natural)]
pc_spell_ks :: Integral i => Spelling i Source
Use spelling from simplest key-signature. Note that this is
ambiguous for 8
, which could be either G Sharp (♯) in A Major
or A Flat (♭) in E Flat (♭) Major.
map pc_spell_ks [6,8] == [(F,Sharp),(A,Flat)]
pc_spell_sharp :: Integral i => Spelling i Source
Use always sharp (♯) spelling.
map pc_spell_sharp [6,8] == [(F,Sharp),(G,Sharp)] Data.List.nub (map (snd . pc_spell_sharp) [1,3,6,8,10]) == [Sharp] octpc_to_pitch pc_spell_sharp (4,6) == Pitch F Sharp 4
pc_spell_flat :: Integral i => Spelling i Source
Use always flat (♭) spelling.
map pc_spell_flat [6,8] == [(G,Flat),(A,Flat)] Data.List.nub (map (snd . pc_spell_flat) [1,3,6,8,10]) == [Flat]