Module:MOS tunings: Difference between revisions

Ganaram inukshuk (talk | contribs)
mNo edit summary
Ganaram inukshuk (talk | contribs)
m todo, comments
Line 12: Line 12:


-- TODO:
-- TODO:
-- - Add a tolerance option to change the cent tolerance for scale degrees, to
--  aid with showing or omitting close-enough ratios
-- - Diatonic interval category lookup?
-- - Diatonic interval category lookup?


Line 120: Line 118:
-- normalized to x:1.)
-- normalized to x:1.)
-- Tolerance is how many cents away from an et-step a ratio can be. This is
-- 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.
-- by default 30% of the small step size, and maxes out at 30 cent. Can be
-- overridden with a custom tolerance value.
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 = tolerance or math.min((mos.equave_to_cents(input_mos) / steps_in_et) * 0.30, 30)
local tolerance = tolerance or math.min((mos.equave_to_cents(input_mos) / steps_in_et) * 0.30, 30)