Module:MOS tuning spectrum: Difference between revisions

Ganaram inukshuk (talk | contribs)
No edit summary
Ganaram inukshuk (talk | contribs)
Experimenting with option to go by int limit of step ratios
Line 15: Line 15:
local input_mos  = args["Input MOS"] or mos.new(5, 2)
local input_mos  = args["Input MOS"] or mos.new(5, 2)
local depth      = args["Depth"] or 5
local comments    = args["Comments"] or {}
local comments    = args["Comments"] or {}
local step_ratios = args["Step Ratios"] or default_ratios
local step_ratios = args["Step Ratios"] or default_ratios
Line 150: Line 149:
-- Parse depth
-- Parse depth
local depth = tonumber(args["Depth"])
local depth = tonumber(args["Depth"])
args["Depth"] = tonumber(args["Depth"])
args["Depth"] = nil
-- If int limit is present, use that over depth
local int_limit = tonumber(args["Int Limit"])
args["Int Limit"] = int_limit
local use_int_limit = args["Int Limit"] ~= nil
-- Parse initial ratios
-- Parse initial ratios
Line 158: Line 162:
-- Then generate mediants and depths
-- Then generate mediants and depths
local step_ratios, depths
local step_ratios, depths
step_ratios, depths = mediants.find_mediants({first_ratio, last_ratio}, depth)
if use_int_limit then
step_ratios, depths = mediants.find_mediants_by_int_limit({first_ratio, last_ratio}, int_limit)
else
step_ratios, depths = mediants.find_mediants({first_ratio, last_ratio}, depth)
end
args["Step Ratios"] = step_ratios
args["Step Ratios"] = step_ratios
args["Depths"] = depths
args["Depths"] = depths