Module:MOS intro: Difference between revisions

Ganaram inukshuk (talk | contribs)
m Fixing up rounding
Ganaram inukshuk (talk | contribs)
Fixed rounding by converting values to strings
Line 117: Line 117:
-- How large is the period in cents? Round to 3 decimal places
-- How large is the period in cents? Round to 3 decimal places
local round = 3
local round = 3
local equave_rounded = utils._round_dec(equave_in_cents, round)
local equave_rounded = tostring(utils._round_dec(equave_in_cents, round))
local period_rounded = utils._round_dec(equave_in_cents / n, round)
local period_rounded = tostring(utils._round_dec(equave_in_cents / n, round))
-- Should step be singular or plural?
-- Should step be singular or plural?
local s_x = ""
local s_x = ""
Line 137: Line 137:
sentence = sentence .. string.format(", repeating every [[octave]].")
sentence = sentence .. string.format(", repeating every [[octave]].")
elseif n == 1 and equave_in_cents ~= 1200 then
elseif n == 1 and equave_in_cents ~= 1200 then
sentence = sentence .. string.format(", repeating every interval of [[%s]] (%).", equave_as_ratio, equave_rounded)
sentence = sentence .. string.format(", repeating every interval of [[%s]] (%).", equave_as_ratio, equave_rounded)
elseif n ~= 1 and equave_in_cents == 1200 then
elseif n ~= 1 and equave_in_cents == 1200 then
sentence = sentence .. string.format(", with a [[period]] of %d large step%s and %d small step%s", x, s_x, y, s_y)
sentence = sentence .. string.format(", with a [[period]] of %d large step%s and %d small step%s", x, s_x, y, s_y)
sentence = sentence .. string.format(" that repeats every %, or %s every [[octave]].", period_rounded, repetition)
sentence = sentence .. string.format(" that repeats every %, or %s every [[octave]].", period_rounded, repetition)
elseif n ~= 1 and equave_in_cents ~= 1200 then
elseif n ~= 1 and equave_in_cents ~= 1200 then
sentence = sentence .. string.format(", with a [[period]] of %d large step%s and %d small step%s", x, s_x, y, s_y)
sentence = sentence .. string.format(", with a [[period]] of %d large step%s and %d small step%s", x, s_x, y, s_y)
sentence = sentence .. string.format(" that repeats every %, or %s every interval of %s (%).", period_rounded, repetition, equave_as_ratio, equave_rounded)
sentence = sentence .. string.format(" that repeats every %, or %s every interval of %s (%).", period_rounded, repetition, equave_as_ratio, equave_rounded)
end
end
Line 193: Line 193:
-- Round values
-- Round values
local round = 3
local round = 3
local bright_gen_min_r = utils._round_dec(bright_gen_min, round)
local bright_gen_min_r = tostring(utils._round_dec(bright_gen_min, round))
local bright_gen_max_r = utils._round_dec(bright_gen_max, round)
local bright_gen_max_r = tostring(utils._round_dec(bright_gen_max, round))
local dark_gen_min_r = utils._round_dec(dark_gen_min, round)
local dark_gen_min_r = tostring(utils._round_dec(dark_gen_min, round))
local dark_gen_max_r = utils._round_dec(dark_gen_max, round)
local dark_gen_max_r = tostring(utils._round_dec(dark_gen_max, round))
local sentence = string.format("[[generator|Generating intervals]] that produce this scale range from %to %, or from %to %.", bright_gen_min_r, bright_gen_max_r, dark_gen_min_r, dark_gen_max_r)
local sentence = string.format("[[generator|Generating intervals]] that produce this scale range from %to %, or from %to %.", bright_gen_min_r, bright_gen_max_r, dark_gen_min_r, dark_gen_max_r)
return sentence
return sentence