hmt-0.20: Haskell Music Theory
Safe HaskellSafe-Inferred
LanguageHaskell2010

Music.Theory.Dynamic_Mark

Contents

Description

Common music notation dynamic marks.

Synopsis

Documentation

data Dynamic_Mark Source #

Enumeration of dynamic mark symbols.

Constructors

Niente 
Ppppp 
Pppp 
Ppp 
Pp 
P 
Mp 
Mf 
F 
Ff 
Fff 
Ffff 
Fffff 
Fp 
Sf 
Sfp 
Sfpp 
Sfz 
Sffz 

Instances

Instances details
Bounded Dynamic_Mark Source # 
Instance details

Defined in Music.Theory.Dynamic_Mark

Enum Dynamic_Mark Source # 
Instance details

Defined in Music.Theory.Dynamic_Mark

Read Dynamic_Mark Source # 
Instance details

Defined in Music.Theory.Dynamic_Mark

Show Dynamic_Mark Source # 
Instance details

Defined in Music.Theory.Dynamic_Mark

Eq Dynamic_Mark Source # 
Instance details

Defined in Music.Theory.Dynamic_Mark

Ord Dynamic_Mark Source # 
Instance details

Defined in Music.Theory.Dynamic_Mark

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

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_Marks 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]]

amp_db :: Floating a => a -> a Source #

JMcC (Sc3) equation.

plot_p1_ln [map amp_db [0,0.005 .. 1]]

db_amp :: Floating a => a -> a Source #

JMcC (Sc3) equation.

plot_p1_ln [map db_amp [-60,-59 .. 0]]

data Hairpin Source #

Enumeration of hairpin indicators.

implied_hairpin :: Dynamic_Mark -> Dynamic_Mark -> Maybe Hairpin Source #

The Hairpin implied by a ordered pair of Dynamic_Marks.

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.

dynamic_sequence :: [Dynamic_Mark] -> [Dynamic_Node] Source #

Calculate a Dynamic_Node sequence from a sequence of Dynamic_Marks.

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

hairpin_ascii :: Hairpin -> String Source #

Ascii pretty printer for Hairpin.

dynamic_sequence_ascii :: [Dynamic_Node] -> String Source #

Ascii pretty printer for Dynamic_Node sequence.