Module:MOS in EDO: Difference between revisions

ArrowHead294 (talk | contribs)
m Non-breaking space
Ganaram inukshuk (talk | contribs)
m rename
 
(5 intermediate revisions by one other user not shown)
Line 1: Line 1:
local p = {}
local mos = require("Module:MOS")
local mos = require("Module:MOS")
local step_vis = require("Module:Step vis")
local tamnams = require("Module:TAMNAMS")
local utils = require("Module:Utils")
local utils = require("Module:Utils")
local tamnams = require("Module:TAMNAMS")
local step_vis = require("Module:Step vis")
local yesno = require("Module:Yesno")
local yesno = require("Module:Yesno")
local p = {}


-- Global variables for cell colors
-- Global variables for cell colors
Line 191: Line 192:
-- Create table, starting with headers
-- Create table, starting with headers
local result = "{| class=\"wikitable center-all\"\n"
local result = "{| class=\"wikitable center-all\"\n"
.. "|+ style=\"font-size: 105%;\" | " .. string.format("Generators %i\\%i and %i\\%i\n", gen_in_edosteps, edo, comp_in_edosteps, edo)
.. "|+ style=\"font-size: 105%; white-space: nowrap;\" | " .. string.format("Generators %i\\%i and %i\\%i\n", gen_in_edosteps, edo, comp_in_edosteps, edo)
.. "|-\n"
.. "|-\n"
.. string.format("! colspan=\"%i\" | Steps\n", edo)
.. string.format("! colspan=\"%i\" | Steps\n", edo)
Line 332: Line 333:
-- Create table, starting with headers
-- Create table, starting with headers
local result = "{| class=\"wikitable center-all\"\n"
local result = "{| class=\"wikitable center-all\"\n"
.. "|+ style=\"font-size: 105%;\" | " .. string.format("Generators %i\\%i and %i\\%i\n", gen_in_edosteps, edo, comp_in_edosteps, edo)
.. "|+ style=\"font-size: 105%; white-space: nowrap;\" | " .. string.format("Generators %i\\%i and %i\\%i\n", gen_in_edosteps, edo, comp_in_edosteps, edo)
.. "|-\n"
.. "|-\n"
.. "! Step visualization\n"
.. "! Step visualization\n"
Line 356: Line 357:
-- Add the step visualization
-- Add the step visualization
local sv = step_vis.step_pattern_to_visualization(current_scale)
local sv = step_vis._step_vis(current_scale)
result = result .. string.format("| %s", sv)
result = result .. string.format("| %s\n", sv)
-- Add the scale sig
-- Add the scale sig
Line 365: Line 366:
local current_step_count = #current_scale
local current_step_count = #current_scale
if large_step_size == small_step_size then
if large_step_size == small_step_size then
result = result .. string.format(" || [[%iedo]]", edo / step_ratio_gcd)
result = result .. string.format("| [[%iedo]]\n", edo / step_ratio_gcd)
elseif tamnams_name ~= nil and current_step_count > 5 then
elseif tamnams_name ~= nil and current_step_count > 5 then
result = result .. string.format(" || [[%s]] (%s)", scale_sig, tamnams_name)
result = result .. string.format("| [[%s]] (%s)\n", scale_sig, tamnams_name)
else
else
result = result .. string.format(" || [[%s]]", scale_sig)
result = result .. string.format("| [[%s]]\n", scale_sig)
end
end
-- Add the step sizes
-- Add the step sizes
result = result .. string.format(" || %i, %i", current_step_sizes["L"], current_step_sizes["s"])
result = result .. string.format("| %i, %i\n", current_step_sizes["L"], current_step_sizes["s"])
-- Add step ratio
-- Add step ratio
local reduced_large_step_size = large_step_size / step_ratio_gcd
local reduced_large_step_size = large_step_size / step_ratio_gcd
local reduced_small_step_size = small_step_size / step_ratio_gcd
local reduced_small_step_size = small_step_size / step_ratio_gcd
result = result .. string.format(" || %s:%s", reduced_large_step_size, reduced_small_step_size)
result = result .. string.format("| %s:%s\n", reduced_large_step_size, reduced_small_step_size)
-- Add the temperament name, if there is one
-- Add the temperament name, if there is one
if show_temperament then
if show_temperament then
local current_step_count = #current_scale
local current_step_count = #current_scale
result = result .. string.format(" || %s[%i]\n", temperament, current_step_count)
result = result .. string.format("| %s[%i]\n", temperament, current_step_count)
end
end
Line 407: Line 408:
local debugg = yesno(frame.args["debug"])
local debugg = yesno(frame.args["debug"])
local result = p.mos_in_edo_simplified(edo, gen_in_edosteps, number_of_periods, generation_limit, temperament)
local result = p.mos_in_edo_simplified(edo, gen_in_edosteps, number_of_periods, generation_limit, temperament)
return frame:preprocess(debugg == true and "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" or result)
-- Debugger option
if debugg == true then
result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>"
end
return frame:preprocess(result)
end
end


return p
return p