Module:MOS tunings: Difference between revisions
m max tolerance within a cent value is now 30 |
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 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 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(( | 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 | ||