Module:MOS intro: Difference between revisions
mNo edit summary |
Added punctuation, added back use of rounding function from utils module to resolve instances of negative 0 |
||
| Line 115: | Line 115: | ||
sentence = sentence .. string.format(" containing %d large step%s and %d small step%s", nL, s_nl, ns, s_ns) | sentence = sentence .. string.format(" containing %d large step%s and %d small step%s", nL, s_nl, ns, s_ns) | ||
-- How | -- How large is the period in cents? Round to 3 decimal places | ||
local round = 3 | |||
local equave_rounded = utils._round_dec(equave_in_cents, round) | |||
local period_rounded = utils._round_dec(equave_in_cents / n, round) | |||
-- Should step be singular or plural? | |||
local s_x = "" | local s_x = "" | ||
local s_y = "" | local s_y = "" | ||
| Line 131: | Line 135: | ||
end | end | ||
if n == 1 and equave_in_cents == 1200 then | if n == 1 and equave_in_cents == 1200 then | ||
sentence = sentence .. string.format(" | 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(" | sentence = sentence .. string.format(", repeating every interval of [[%s]] (%f¢).", 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 % | sentence = sentence .. string.format(" that repeats every %f¢, 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 % | sentence = sentence .. string.format(" that repeats every %f¢, or %s every interval of %s (%f¢).", period_rounded, repetition, equave_as_ratio, equave_rounded) | ||
end | end | ||