Music.Theory.Duration.Annotation

Description

Duration annotations.

Synopsis

# Documentation

Standard music notation durational model annotations

Constructors

 Tie_Right Tie_Left Begin_Tuplet (Integer, Integer, Duration) End_Tuplet

Instances

 Source # Methods Source # MethodsshowList :: [D_Annotation] -> ShowS #

type Duration_A = (Duration, [D_Annotation]) Source #

Annotated Duration.

Does Duration_A begin a tuplet?

Does Duration_A end a tuplet?

Is Duration_A tied to the the right?

da_tuplet :: (Integer, Integer) -> [Duration_A] -> [Duration_A] Source #

Annotate a sequence of Duration_A as a tuplet.

import Music.Theory.Duration.Name
da_tuplet (3,2) [(quarter_note,[Tie_Left]),(eighth_note,[Tie_Right])]

Group tuplets into a Tree. Branch nodes have label Nothing, leaf nodes label Just Duration_A.

import Music.Theory.Duration.Name.Abbreviation
let d = [(q,[])
,(e,[Begin_Tuplet (3,2,e)])
,(s,[Begin_Tuplet (3,2,s)]),(s,[]),(s,[End_Tuplet])
,(e,[End_Tuplet])
,(q,[])]
in catMaybes (flatten (da_group_tuplets d)) == d

break_left :: (a -> Bool) -> [a] -> ([a], [a]) Source #

Variant of break that places separator at left.

break_left (== 3) [1..6] == ([1..3],[4..6])
break_left (== 3) [1..3] == ([1..3],[])

sep_balanced :: Bool -> (a -> Bool) -> (a -> Bool) -> [a] -> ([a], [a]) Source #

Variant of break_left that balances begin & end predicates.

break_left (== ')') "test (sep) _) balanced"
sep_balanced True (== '(') (== ')') "test (sep) _) balanced"
sep_balanced False (== '(') (== ')') "(test (sep) _) balanced"

Group non-nested tuplets, ie. groups nested tuplets at one level.

zip_kr :: [a] -> [b] -> ([(a, b)], [b]) Source #

Keep right variant of zip, unused rhs values are returned.

zip_kr [1..4] ['a'..'f'] == ([(1,'a'),(2,'b'),(3,'c'),(4,'d')],"ef")

nn_reshape :: (a -> b -> c) -> [Either a [a]] -> [b] -> [Either c [c]] Source #

zipWith variant that adopts the shape of the lhs.

let {p = [Left 1,Right [2,3],Left 4]
;q = "abcd"}
in nn_reshape (,) p q == [Left (1,'a'),Right [(2,'b'),(3,'c')],Left (4,'d')]

d_annotated_tied_lr :: [D_Annotation] -> (Bool, Bool) Source #

Does a have Tie_Left and Tie_Right?

Does d have Tie_Left and Tie_Right?