hmt-diagrams-0.14: Haskell Music Theory Diagrams

Safe HaskellNone

Music.Theory.Tuning.Table

Contents

Description

Tuning tables

Synopsis

Equal temperament

tbl_12et :: [(Pitch, Double)]Source

12-tone equal temperament table equating Pitch and frequency over range of human hearing, where A4 = 440hz.

 length tbl_12et == 132
 min_max (map (round . snd) tbl_12et) == (16,31609)

tbl_24et :: [(Pitch, Double)]Source

24-tone equal temperament variant of tbl_12et.

 length tbl_24et == 264
 min_max (map (round . snd) tbl_24et) == (16,32535)

bounds_et_table :: Ord s => [(t, s)] -> s -> Maybe ((t, s), (t, s))Source

Given an ET table (or like) find bounds of frequency.

 let r = Just (at_pair octpc_to_pitch_cps ((3,11),(4,0)))
 in bounds_et_table tbl_12et 256 == r

bounds_12et_tone :: Double -> Maybe ((Pitch, Double), (Pitch, Double))Source

bounds_et_table of tbl_12et.

 map bounds_12et_tone (hsn 17 55)

type HS_R = (Double, Pitch, Double, Double, Cents)Source

Tuple indicating nearest Pitch to frequency with ET frequency, and deviation in hertz and Cents.

nearest_et_table_tone :: [(Pitch, Double)] -> Double -> HS_RSource

Form HS_R for frequency by consulting table.

 let {f = 256
     ;f' = octpc_to_cps (4,0)
     ;r = (f,Pitch C Natural 4,f',f-f',to_cents (f/f'))}
 in nearest_et_table_tone tbl_12et 256 == r

Cell

ndp :: Int -> Double -> StringSource

n-decimal places.

 ndp 3 (1/3) == "0.333"

hs_r_cell :: Int -> (Int -> String) -> [HS_R] -> (Int, Int) -> Table_CellSource

Table_Cell from set of HS_R.