Module:MOS in EDO: Difference between revisions

Ganaram inukshuk (talk | contribs)
Merged tamnams name column with mos column
Ganaram inukshuk (talk | contribs)
Added limits to what tamnams names to show (monowood and biwood won't be shown)
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 (and TAMNAMS name)\n')
result = result .. string.format('!MOS (TAMNAMS name)\n')
result = result .. string.format('!Step ratio\n')
result = result .. string.format('!Step ratio\n')
if show_temperament then
if show_temperament then
Line 201: 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
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)
-- Calculate current step ratio
-- Use this to determine whether the current mos is actually an edo
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
-- Get the tamnams name, if there is one
-- Don't show tamnams names for mosses with 5 notes or fewer (to keep the table from being cluttered)
local tamnams_name = mos.tamnams_name[scale_sig]
local tamnams_name = mos.tamnams_name[scale_sig]
local current_step_count = #current_scale
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
elseif tamnams_name ~= nil and current_step_count > 5 then
result = result .. string.format("| [[%s]] (%s)\n", scale_sig, tamnams_name)
result = result .. string.format("| [[%s]] (%s)\n", scale_sig, tamnams_name)
else
else