Module:MOS tuning spectrum: Difference between revisions

Ganaram inukshuk (talk | contribs)
m bugfix
Ganaram inukshuk (talk | contribs)
mNo edit summary
Line 88: Line 88:
-- Calculate the bright gen and cent value
-- Calculate the bright gen and cent value
local bright_generator_steps  = mos.bright_gen_to_et_steps(input_mos, step_ratio)
local bright_generator_steps  = mos.bright_gen_to_et_steps (input_mos, step_ratio)
local bright_generator_cents  = mos.bright_gen_to_cents(input_mos, step_ratio)
local bright_generator_cents  = mos.bright_gen_to_cents   (input_mos, step_ratio)
local bright_generator_string = mos.bright_gen_to_et_string(input_mos, step_ratio, "")
local bright_generator_string = mos.bright_gen_to_et_string(input_mos, step_ratio, "")
-- Calculate dark generator step count and cent value
-- Calculate dark generator step count and cent value
local dark_generator_steps = mos.dark_gen_to_et_steps(input_mos, step_ratio)
local dark_generator_steps = mos.dark_gen_to_et_steps(input_mos, step_ratio)
local dark_generator_cents = mos.dark_gen_to_cents(input_mos, step_ratio)
local dark_generator_cents = mos.dark_gen_to_cents   (input_mos, step_ratio)
-- New row
-- New row
Line 111: Line 111:
-- Cells for generators in cents
-- Cells for generators in cents
result = result .. string.format("| %.3f\n", bright_generator_cents)
result = result .. string.format("| %.3f\n", bright_generator_cents)
result = result .. string.format("| %.3f\n", dark_generator_cents)
result = result .. string.format("| %.3f\n", dark_generator_cents )
-- Cell for step ratio
-- Cell for step ratio
Line 127: Line 127:
-- The step ratio is (literally and figuratively) the key to add comments!
-- The step ratio is (literally and figuratively) the key to add comments!
-- Before using it, simplify it
-- Before using it, simplify it
local large_step_size = step_ratios[i][1]
local large_step = step_ratio[1]
local small_step_size = step_ratios[i][2]
local small_step = step_ratio[2]
local gcd = utils.gcd(large_step_size, small_step_size)
local gcd = utils.gcd(large_step, small_step)
local key = large_step_size / gcd .. "/" .. small_step_size / gcd
local key = large_step / gcd .. "/" .. small_step / gcd
-- Cell for comment
-- Cell for comment