module Music.Theory.Tuning.Syntonic where
import Data.List
import Music.Theory.Tuning
mk_isomorphic_layout :: Integral a => a -> a -> (a,a) -> [[(a,a)]]
mk_isomorphic_layout n_row n_col top_left =
let (a,b) `plus` (c,d) = (a+c,b+d)
mk_seq 0 _ _ = []
mk_seq n i z = z : mk_seq (n1) i (z `plus` i)
left = mk_seq n_row (1,1) top_left
in map (mk_seq n_col (1,2)) left
minimal_isomorphic_note_layout :: [[(Int,Int)]]
minimal_isomorphic_note_layout =
[[(3,4),(2,2),(1,0),(0,2),(1,4)]
,[(2,3),(1,1),(0,1),(1,3)]
,[(2,4),(1,2),(0,0),(1,2),(2,4)]]
rank_two_regular_temperament :: Integral a => a -> a -> [(a,a)] -> [a]
rank_two_regular_temperament a b = let f (i,j) = i * a + j * b in map f
mk_syntonic_tuning :: Int -> [Cents]
mk_syntonic_tuning b =
let l = mk_isomorphic_layout 5 7 (3,4)
t = map (rank_two_regular_temperament 1200 b) l
in nub (sort (map (\x -> fromIntegral (x `mod` 1200)) (concat t)))
syntonic_697 :: Tuning
syntonic_697 = Tuning (Right (mk_syntonic_tuning 697)) 2
syntonic_702 :: Tuning
syntonic_702 = Tuning (Right (mk_syntonic_tuning 702)) 2