hmt-0.16: Haskell Music Theory

Music.Theory.Dynamic_Mark

Contents

Description

Common music notation dynamic marks.

Synopsis

# Documentation

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

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

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

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
map dynamic_mark_midi [FP,SF,SFP,SFPP,SFZ,SFFZ] == replicate 6 Nothing

Error variant.

midi_dynamic_mark :: (Ord n, Num n, Enum n) => n -> Maybe Dynamic_Mark_T Source #

Map midi velocity (0-127) to dynamic mark.

histogram (mapMaybe midi_dynamic_mark [0 .. 127])

dynamic_mark_db :: Fractional n => n -> Dynamic_Mark_T -> Maybe n Source #

Translate fixed Dynamic_Mark_Ts 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
plotTable [map (ampmidid 20) [0 .. 127],map (ampmidid 60) [0 .. 127]]

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

JMcC (SC3) equation.

plotTable1 (map amp_db [0,0.005 .. 1])

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

JMcC (SC3) equation.

plotTable1 (map db_amp [-60,-59 .. 0])

data Hairpin_T Source #

Enumeration of hairpin indicators.

Constructors

 Crescendo Diminuendo End_Hairpin

Instances

 Source # Methods Source # MethodsenumFrom :: Hairpin_T -> [Hairpin_T] # Source # Methods Source # Methods Source # MethodsshowList :: [Hairpin_T] -> ShowS #

The Hairpin_T implied by a ordered pair of Dynamic_Mark_Ts.

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

A node in a dynamic sequence.

The empty Dynamic_Node.

Calculate a Dynamic_Node sequence from a sequence of Dynamic_Mark_Ts.

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

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 -> a Source #

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

# ASCII

ASCII pretty printer for Dynamic_Mark_T.

ASCII pretty printer for Hairpin_T.

ASCII pretty printer for Dynamic_Node.

ASCII pretty printer for Dynamic_Node sequence.