hmt-0.14: Haskell Music Theory

Safe HaskellSafe-Inferred

Music.Theory.Pitch.Spelling.Cluster

Description

Spelling for chromatic clusters.

Synopsis

Documentation

spell_cluster_c4_table :: [([PitchClass], [Pitch])]Source

Spelling table for chromatic clusters.

 let f (p,q) = p == sort (map (snd . pitch_to_octpc) q)
 in all f spell_cluster_c4_table == True

spell_cluster_c4 :: [PitchClass] -> Maybe [Pitch]Source

Spelling for chromatic clusters. Sequence must be ascending. Pitch class 0 maps to c4, if there is no 0 then all notes are in octave 4.

 let f = fmap (map pitch_pp) . spell_cluster_c4
 in map f [[11,0],[11]] == [Just ["B3","C4"],Just ["B4"]]
 fmap (map pitch_pp) (spell_cluster_c4 [10,11]) == Just ["A♯4","B4"]

spell_cluster_c :: Octave -> [PitchClass] -> Maybe [Pitch]Source

Variant of spell_cluster_c4 that runs pitch_edit_octave. An octave of 4 is the identitiy, 3 an octave below, 5 an octave above.

 fmap (map pitch_pp) (spell_cluster_c 3 [11,0]) == Just ["B2","C3"]
 fmap (map pitch_pp) (spell_cluster_c 3 [10,11]) == Just ["A♯3","B3"]

spell_cluster_f :: (PitchClass -> Octave) -> [PitchClass] -> Maybe [Pitch]Source

Variant of spell_cluster_c4 that runs pitch_edit_octave so that the left-most note is in the octave given by f.

 import Data.Maybe
 let {f n = if n >= 11 then 3 else 4
     ;g = map pitch_pp .fromJust . spell_cluster_f f
     ;r = [["B3","C4"],["B3"],["C4"],["A♯4","B4"]]}
 in map g [[11,0],[11],[0],[10,11]] == r

spell_cluster_left :: Octave -> [PitchClass] -> Maybe [Pitch]Source

Variant of spell_cluster_c4 that runs pitch_edit_octave so that the left-most note is in octave o.

 fmap (map pitch_pp) (spell_cluster_left 3 [11,0]) == Just ["B3","C4"]
 fmap (map pitch_pp) (spell_cluster_left 3 [10,11]) == Just ["A♯3","B3"]