Module:MOS tunings: Difference between revisions

Ganaram inukshuk (talk | contribs)
m max tolerance within a cent value is now 30
Ganaram inukshuk (talk | contribs)
Comments; simplify some code; removed unnecessary modules
Line 2: Line 2:
local tamnams = require("Module:TAMNAMS")
local tamnams = require("Module:TAMNAMS")
local et = require("Module:ET")
local et = require("Module:ET")
local rat = require("Module:Rational")
local yesno = require("Module:Yesno")
local yesno = require("Module:Yesno")
local tip = require("Module:Template input parse")
local tip = require("Module:Template input parse")
local jira = require("Module:JI ratios")
local jira = require("Module:JI ratios")
local utils = require("Module:Utils")
local p = {}
local p = {}


Line 113: Line 111:
-- Calculate the tolerance, the range in which ratios can be accepted +/-
-- Calculate the tolerance, the range in which ratios can be accepted +/-
-- from an et-step. (ET may be a non-integer value.)
-- from an et-step. (ET may be a non-integer value, since the L:s ratio is
-- normalized to x:1.)
-- Tolerance is how many cents away from an et-step a ratio can be. This is
-- 30% of the small step size, and maxes out at 30 cents.
local steps_in_et = input_mos.nL * avg_step_ratio[1] + input_mos.ns * avg_step_ratio[2]
local steps_in_et = input_mos.nL * avg_step_ratio[1] + input_mos.ns * avg_step_ratio[2]
local tolerance = math.min((rat.cents(input_mos.equave) / steps_in_et) * 0.30, 30)
local tolerance = math.min((mos.equave_to_cents(input_mos) / steps_in_et) * 0.30, 30)
-- Calculate the cent values for each interval in the modal union
-- Calculate the cent values for each interval in the modal union