Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Common music notation dynamic marks.
Synopsis
- data Dynamic_Mark
- dynamic_mark_t_parse_ci :: String -> Maybe Dynamic_Mark
- dynamic_mark_midi :: (Num n, Enum n) => Dynamic_Mark -> Maybe n
- dynamic_mark_midi_err :: Integral n => Dynamic_Mark -> n
- midi_dynamic_mark :: (Ord n, Num n, Enum n) => n -> Maybe Dynamic_Mark
- dynamic_mark_db :: Fractional n => n -> Dynamic_Mark -> Maybe n
- ampmidid :: Floating a => a -> a -> a
- amp_db :: Floating a => a -> a
- db_amp :: Floating a => a -> a
- data Hairpin
- implied_hairpin :: Dynamic_Mark -> Dynamic_Mark -> Maybe Hairpin
- type Dynamic_Node = (Maybe Dynamic_Mark, Maybe Hairpin)
- empty_dynamic_node :: Dynamic_Node
- dynamic_sequence :: [Dynamic_Mark] -> [Dynamic_Node]
- delete_redundant_marks :: [Maybe Dynamic_Mark] -> [Maybe Dynamic_Mark]
- dynamic_sequence_sets :: [Maybe Dynamic_Mark] -> [Maybe Dynamic_Node]
- apply_dynamic_node :: (a -> Dynamic_Mark -> a) -> (a -> Hairpin -> a) -> Dynamic_Node -> a -> a
- dynamic_mark_ascii :: Dynamic_Mark -> String
- hairpin_ascii :: Hairpin -> String
- dynamic_node_ascii :: Dynamic_Node -> String
- dynamic_sequence_ascii :: [Dynamic_Node] -> String
Documentation
data Dynamic_Mark Source #
Enumeration of dynamic mark symbols.
Instances
dynamic_mark_t_parse_ci :: String -> Maybe Dynamic_Mark Source #
Case insensitive reader for Dynamic_Mark
.
map dynamic_mark_t_parse_ci (words "pP p Mp F")
dynamic_mark_midi :: (Num n, Enum n) => Dynamic_Mark -> Maybe n Source #
Lookup Midi velocity for Dynamic_Mark
. The range is linear in 0-127
.
let r = [0,6,17,28,39,50,61,72,83,94,105,116,127] mapMaybe dynamic_mark_midi [Niente .. Fffff] == r
mapMaybe dynamic_mark_midi [Pp .. Ff] == [39,50,61,72,83,94]
map dynamic_mark_midi [Fp,Sf,Sfp,Sfpp,Sfz,Sffz] == replicate 6 Nothing
dynamic_mark_midi_err :: Integral n => Dynamic_Mark -> n Source #
Error variant.
midi_dynamic_mark :: (Ord n, Num n, Enum n) => n -> Maybe Dynamic_Mark Source #
Map midi velocity (0-127) to dynamic mark.
histogram (mapMaybe midi_dynamic_mark [0 .. 127])
dynamic_mark_db :: Fractional n => n -> Dynamic_Mark -> Maybe n Source #
Translate fixed Dynamic_Mark
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]
ampmidid :: Floating a => a -> a -> a Source #
http://www.csounds.com/manual/html/ampmidid.html
import Sound.Sc3.Plot plot_p1_ln [map (ampmidid 20) [0 .. 127],map (ampmidid 60) [0 .. 127]]
Enumeration of hairpin indicators.
Instances
Bounded Hairpin Source # | |
Enum Hairpin Source # | |
Show Hairpin Source # | |
Eq Hairpin Source # | |
Ord Hairpin Source # | |
implied_hairpin :: Dynamic_Mark -> Dynamic_Mark -> Maybe Hairpin Source #
The Hairpin
implied by a ordered pair of Dynamic_Mark
s.
map (implied_hairpin Mf) [Mp,F] == [Just Diminuendo,Just Crescendo]
type Dynamic_Node = (Maybe Dynamic_Mark, Maybe Hairpin) Source #
A node in a dynamic sequence.
empty_dynamic_node :: Dynamic_Node Source #
The empty Dynamic_Node
.
dynamic_sequence :: [Dynamic_Mark] -> [Dynamic_Node] Source #
Calculate a Dynamic_Node
sequence from a sequence of Dynamic_Mark
s.
let r = [(Just Pp,Just Crescendo), (Just Mp,Just End_Hairpin) ,(Nothing,Just Diminuendo) ,(Just Pp,Just End_Hairpin)] dynamic_sequence [Pp,Mp,Mp,Pp] == r
delete_redundant_marks :: [Maybe Dynamic_Mark] -> [Maybe Dynamic_Mark] Source #
Delete redundant (unaltered) dynamic marks.
let r = [Just P,Nothing,Nothing,Nothing,Just F] delete_redundant_marks [Just P,Nothing,Just P,Just P,Just F] == r
dynamic_sequence_sets :: [Maybe Dynamic_Mark] -> [Maybe Dynamic_Node] Source #
Variant of dynamic_sequence
for sequences of Dynamic_Mark
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)] dynamic_sequence_sets [Just P,Just F,Nothing,Just P] == r
dynamic_sequence_sets [Just P,Nothing,Just P] == [Just (Just P,Nothing),Nothing,Nothing]
apply_dynamic_node :: (a -> Dynamic_Mark -> a) -> (a -> Hairpin -> a) -> Dynamic_Node -> a -> a Source #
Apply Hairpin
and Dynamic_Mark
functions in that order as required by Dynamic_Node
.
let f _ x = show x apply_dynamic_node f f (Nothing,Just Crescendo) undefined
Ascii
dynamic_mark_ascii :: Dynamic_Mark -> String Source #
Ascii pretty printer for Dynamic_Mark
.
dynamic_node_ascii :: Dynamic_Node -> String Source #
Ascii pretty printer for Dynamic_Node
.
dynamic_sequence_ascii :: [Dynamic_Node] -> String Source #
Ascii pretty printer for Dynamic_Node
sequence.