Module:MOS in EDO: Difference between revisions

Ganaram inukshuk (talk | contribs)
Added comments; corrected code regarding degenerate mosses (mosses that become edos)
Ganaram inukshuk (talk | contribs)
Merged tamnams name column with mos column
Line 181: Line 181:
result = result .. string.format('|-\n')
result = result .. string.format('|-\n')
result = result .. string.format('! colspan="%i" |Steps for generators %i\\%i and %i\\%i\n', edo, gen_in_edosteps, edo, comp_in_edosteps, edo)
result = result .. string.format('! colspan="%i" |Steps for generators %i\\%i and %i\\%i\n', edo, gen_in_edosteps, edo, comp_in_edosteps, edo)
result = result .. string.format('!Mos\n')
result = result .. string.format('!MOS (and TAMNAMS name)\n')
result = result .. string.format('!Step ratio\n')
result = result .. string.format('!Step ratio\n')
result = result .. string.format('!TAMNAMS name\n')
if show_temperament then
if show_temperament then
result = result .. string.format('!Temperament\n')
result = result .. string.format('!Temperament\n')
Line 202: Line 201:
-- Add the scale sig
-- Add the scale sig
-- If there a tamnams name, include it in parentheses after the scalesig
-- If the mos is an edo, say it's an edo instead
-- If the mos is an edo, say it's an edo instead
local scale_sig = p.mos_step_pattern_to_scale_sig(current_scale)
local scale_sig = p.mos_step_pattern_to_scale_sig(current_scale)
local current_step_sizes = p.calculate_step_sizes(current_scale)
local current_step_sizes = p.calculate_step_sizes(current_scale)
local step_ratio_gcd = utils._gcd(current_step_sizes["L"], current_step_sizes["s"])
local step_ratio_gcd = utils._gcd(current_step_sizes["L"], current_step_sizes["s"])
local reduced_large_step_size = current_step_sizes["L"] / step_ratio_gcd
local reduced_large_step_size = current_step_sizes["L"] / step_ratio_gcd
local reduced_small_step_size = current_step_sizes["s"] / step_ratio_gcd
local reduced_small_step_size = current_step_sizes["s"] / step_ratio_gcd
local tamnams_name = mos.tamnams_name[scale_sig]
if reduced_large_step_size == reduced_small_step_size then
if reduced_large_step_size == reduced_small_step_size then
result = result .. string.format("| %iedo\n", edo / step_ratio_gcd)
result = result .. string.format("| [[%iedo]]\n", edo / step_ratio_gcd)
elseif tamnams_name ~= nil then
result = result .. string.format("| [[%s]] (%s)\n", scale_sig, tamnams_name)
else
else
result = result .. string.format("| [[%s]]\n", scale_sig)
result = result .. string.format("| [[%s]]\n", scale_sig)
Line 216: Line 222:
-- Add the step ratio
-- Add the step ratio
result = result .. string.format("| %s:%s\n", current_step_sizes["L"] / step_ratio_gcd, current_step_sizes["s"] / step_ratio_gcd)
result = result .. string.format("| %s:%s\n", current_step_sizes["L"] / step_ratio_gcd, current_step_sizes["s"] / step_ratio_gcd)
-- Add the tamnams name
local tamnams_name = mos.tamnams_name[scale_sig]
if tamnams_name ~= nil then
result = result .. string.format("| %s\n", tamnams_name)
else
result = result .. string.format("|\n")
end
-- Add the temperament name, if there is one
-- Add the temperament name, if there is one