Aberrismic theory: Difference between revisions

Inthar (talk | contribs)
m Code: Added Haskell code for searching for edos with aberrismic scales
Inthar (talk | contribs)
Line 83: Line 83:


{- Return a list of (edo, step ratio) tuples for the `(countL)L(countM)M(countS)s` aberrismic scale where `edo <= edoBound`,
{- Return a list of (edo, step ratio) tuples for the `(countL)L(countM)M(countS)s` aberrismic scale where `edo <= edoBound`,
   where the tuning's s step satisfies the bound `aberLower` <= s <= `aberUpper`. -}
   where the tuning's s step satisfies the bound `aberLower` <= s <= `aberUpper`.
  Non-coprime step ratios are reduced. -}
boundedEdosWithAberrismicScale :: Int -> Float -> Float -> Int -> Int -> Int -> [(Int, (Int, Int, Int))]
boundedEdosWithAberrismicScale :: Int -> Float -> Float -> Int -> Int -> Int -> [(Int, (Int, Int, Int))]
boundedEdosWithAberrismicScale edoBound aberLower aberUpper countL countM countS =  
boundedEdosWithAberrismicScale edoBound aberLower aberUpper countL countM countS =  
Line 90: Line 91:
     sizesOfM = [2..edoBound] -- smallest m possible in n-edo is 2\n  
     sizesOfM = [2..edoBound] -- smallest m possible in n-edo is 2\n  
     sizesOfL = [3..edoBound] -- smallest L possible in n-edo is 3\n
     sizesOfL = [3..edoBound] -- smallest L possible in n-edo is 3\n
   in filter (\x -> (fst x) <= edoBound) $ sortBy (\x y -> compare (fst x) (fst y)) [ (edo, (x, y, z))  
   in filter (\x -> (fst x) <= edoBound) $ sortBy (\x y -> compare (fst x) (fst y)) [ (edo, (x`div`d, y`div`d, z`div`d))  
       | x <- sizesOfL, y <- sizesOfM, z <- sizesOfS,  
       | x <- sizesOfL, y <- sizesOfM, z <- sizesOfS,  
        let d = gcd x (gcd y z),
         let edo = countL*x + countM*y + countS*z,
         let edo = countL*x + countM*y + countS*z,
         let aberSize = stepsOfEdoInCents z edo,
         let aberSize = stepsOfEdoInCents z edo,