Safe Haskell | Safe-Inferred |
---|

Common music notation dynamic marks.

- data Dynamic_Mark_T
- dynamic_mark_midi :: (Num n, Enum n) => Dynamic_Mark_T -> Maybe n
- dynamic_mark_db :: Fractional n => n -> Dynamic_Mark_T -> Maybe n
- data Hairpin_T
- = Crescendo
- | Diminuendo
- | End_Hairpin

- implied_hairpin :: Dynamic_Mark_T -> Dynamic_Mark_T -> Maybe Hairpin_T
- type Dynamic_Node = (Maybe Dynamic_Mark_T, Maybe Hairpin_T)
- empty_dynamic_node :: Dynamic_Node
- dynamic_sequence :: [Dynamic_Mark_T] -> [Dynamic_Node]
- delete_redundant_marks :: [Maybe Dynamic_Mark_T] -> [Maybe Dynamic_Mark_T]
- dynamic_sequence_sets :: [Maybe Dynamic_Mark_T] -> [Maybe Dynamic_Node]
- apply_dynamic_node :: (a -> Dynamic_Mark_T -> a) -> (a -> Hairpin_T -> a) -> Dynamic_Node -> a -> a

# Documentation

data Dynamic_Mark_T Source

Enumeration of dynamic mark symbols.

dynamic_mark_midi :: (Num n, Enum n) => Dynamic_Mark_T -> Maybe nSource

Lookup MIDI velocity for `Dynamic_Mark_T`

. The range is linear
in `0-127`

.

let r = [0,6,17,28,39,50,61,72,83,94,105,116,127] in mapMaybe dynamic_mark_midi [Niente .. FFFFF] == r

dynamic_mark_db :: Fractional n => n -> Dynamic_Mark_T -> Maybe nSource

Translate *fixed* `Dynamic_Mark_T`

s to *db* amplitude over given
*range*.

mapMaybe (dynamic_mark_db 120) [Niente,P,F,FFFFF] == [-120,-70,-40,0] mapMaybe (dynamic_mark_db 60) [Niente,P,F,FFFFF] == [-60,-35,-20,0]

Enumeration of hairpin indicators.

implied_hairpin :: Dynamic_Mark_T -> Dynamic_Mark_T -> Maybe Hairpin_TSource

The `Hairpin_T`

implied by a ordered pair of `Dynamic_Mark_T`

s.

map (implied_hairpin MF) [MP,F] == [Just Diminuendo,Just Crescendo]

type Dynamic_Node = (Maybe Dynamic_Mark_T, Maybe Hairpin_T)Source

A node in a dynamic sequence.

empty_dynamic_node :: Dynamic_NodeSource

The empty `Dynamic_Node`

.

dynamic_sequence :: [Dynamic_Mark_T] -> [Dynamic_Node]Source

Calculate a `Dynamic_Node`

sequence from a sequence of
`Dynamic_Mark_T`

s.

dynamic_sequence [PP,MP,MP,PP] == [(Just PP,Just Crescendo) ,(Just MP,Just End_Hairpin) ,(Nothing,Just Diminuendo) ,(Just PP,Just End_Hairpin)]

delete_redundant_marks :: [Maybe Dynamic_Mark_T] -> [Maybe Dynamic_Mark_T]Source

Delete redundant (unaltered) dynamic marks.

let s = [Just P,Nothing,Just P,Just P,Just F] in delete_redundant_marks s == [Just P,Nothing,Nothing,Nothing,Just F]

dynamic_sequence_sets :: [Maybe Dynamic_Mark_T] -> [Maybe Dynamic_Node]Source

Variant of `dynamic_sequence`

for sequences of `Dynamic_Mark_T`

with holes (ie. rests). Runs `delete_redundant_marks`

.

let r = [Just (Just P,Just Crescendo),Just (Just F,Just End_Hairpin) ,Nothing,Just (Just P,Nothing)] in dynamic_sequence_sets [Just P,Just F,Nothing,Just P] == r

let s = [Just P,Nothing,Just P] in dynamic_sequence_sets s = [Just (Just P,Nothing),Nothing,Nothing]

apply_dynamic_node :: (a -> Dynamic_Mark_T -> a) -> (a -> Hairpin_T -> a) -> Dynamic_Node -> a -> aSource

Apply `Hairpin_T`

and `Dynamic_Mark_T`

functions in that order as
required by `Dynamic_Node`

.

let f _ x = show x in apply_dynamic_node f f (Nothing,Just Crescendo) undefined