Module:MOS tuning spectrum: Difference between revisions
m bugfix |
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 | local large_step = step_ratio[1] | ||
local | local small_step = step_ratio[2] | ||
local gcd = utils.gcd( | local gcd = utils.gcd(large_step, small_step) | ||
local key = | local key = large_step / gcd .. "/" .. small_step / gcd | ||
-- Cell for comment | -- Cell for comment | ||