Aberrismic theory: Difference between revisions

Inthar (talk | contribs)
No edit summary
Tags: Mobile edit Mobile web edit
Inthar (talk | contribs)
m →Code: Added Haskell code for searching for edos with aberrismic scales
Line 74: Line 74:
# Investigate counterpoint in diatonic-based aberrismic scales.
# Investigate counterpoint in diatonic-based aberrismic scales.
== Code ==
== Code ==
Haskell function for edo tunings of aberrismic scales:
<syntaxhighlight lang="haskell">
import Data.List
-- k\edo in cents.
stepsOfEdoInCents :: Int -> Int -> Float
stepsOfEdoInCents k edo = 1200*fromIntegral k/fromIntegral edo
{- 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`. -}
boundedEdosWithAberrismicScale :: Int -> Float -> Float -> Int -> Int -> Int -> [(Int, (Int, Int, Int))]
boundedEdosWithAberrismicScale edoBound aberLower aberUpper countL countM countS =
  let
    sizesOfS = [1..edoBound] -- smallest s possible in n-edo is 1\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
  in filter (\x -> (fst x) <= edoBound) $ sortBy (\x y -> compare (fst x) (fst y)) [ (edo, (x, y, z))
      | x <- sizesOfL, y <- sizesOfM, z <- sizesOfS,
        let edo = countL*x + countM*y + countS*z,
        let aberSize = stepsOfEdoInCents z edo,
        x > y && y > z && aberLower <= aberSize && aberSize <= aberUpper ]
</syntaxhighlight>
[[Category:Terms]]
[[Category:Terms]]
[[Category:Aberrismic theory|*]]
[[Category:Aberrismic theory|*]]