Module:MOS tuning spectrum: Difference between revisions

Ganaram inukshuk (talk | contribs)
mNo edit summary
Ganaram inukshuk (talk | contribs)
No edit summary
Line 21: Line 21:
local equave = input_mos.equave
local equave = input_mos.equave
local L = input_mos.nL -- Large steps in mos
local large_steps = input_mos.nL -- Large steps in mos
local s = input_mos.ns -- Small steps in mos
local small_steps = input_mos.ns -- Small steps in mos
local n = utils._gcd(L, s) -- Number of periods
local periods    = mos.period_count(input_mos) -- Number of periods
-- What is the equave suffix (edo, edt, edf, ed-p/q)
-- What is the et suffix (edo, edt, edf, ed-p/q)?
local equave_suffix = ""
local et_suffix = mos.mos_to_et_suffix(input_mos)
if rat.eq(input_mos.equave, rat.new(2)) then
equave_suffix = "o"
elseif rat.eq(input_mos.equave, rat.new(3)) then
equave_suffix = "t"
elseif rat.eq(input_mos.equave, rat.new(3, 2)) then
equave_suffix = "f"
else
equave_suffix = rat.as_ratio(input_mos.equave)
end
-- Default comments for TAMNAMS-named step ratios
-- Default comments for TAMNAMS-named step ratios
Line 53: Line 44:
-- Monosmall mosses and knL ns mosses are always proper, but all other mosses
-- Monosmall mosses and knL ns mosses are always proper, but all other mosses
-- are proper if the step ratio is within the soft-of-basic range
-- are proper if the step ratio is within the soft-of-basic range
if n < s then
if periods < small_steps then
default_comments["2/1"] = default_comments["2/1"] .. "<br />Scales with tunings softer than this are proper"
default_comments["2/1"] = default_comments["2/1"] .. "<br />Scales with tunings softer than this are proper"
end
end
Line 59: Line 50:
-- Produce table header for the comments
-- Produce table header for the comments
local comments_header_text = "Comments"
local comments_header_text = "Comments"
if s == 1 then
if small_steps == 1 then
comments_header_text = comments_header_text .. "<sup><abbr title=\"Every tuning produces a proper scale.\">(always proper)</abbr></sup>"
comments_header_text = comments_header_text .. "<sup><abbr title=\"Every tuning produces a proper scale.\">(always proper)</abbr></sup>"
elseif s == n and n > 1 then
elseif small_steps == periods and periods > 1 then
comments_header_text = comments_header_text .. "<sup><abbr title=\"Every true-mos tuning produces a proper scale.\">(always proper)</abbr></sup>"
comments_header_text = comments_header_text .. "<sup><abbr title=\"Every true-mos tuning produces a proper scale.\">(always proper)</abbr></sup>"
end
end
Line 74: Line 65:
.. "|+ style=\"font-size: 105%; white-space: nowrap;\" | " .. string.format("Scale tree and tuning spectrum of %s\n", mos_as_string)
.. "|+ style=\"font-size: 105%; white-space: nowrap;\" | " .. string.format("Scale tree and tuning spectrum of %s\n", mos_as_string)
.. "|-\n"
.. "|-\n"
.. string.format("! rowspan=\"2\" colspan=\"%d\" | Generator<sup><abbr title=\"In steps of ed%s.\">(ed%s)</abbr></sup>\n", depth + 1, equave_suffix, equave_suffix)
.. string.format("! rowspan=\"2\" colspan=\"%d\" | Generator<sup><abbr title=\"In steps of %s.\">(%s)</abbr></sup>\n", depth + 1, et_suffix, et_suffix)
.. "! colspan=\"2\" | Cents\n"
.. "! colspan=\"2\" | Cents\n"
.. "! colspan=\"2\" | Step ratio\n"
.. "! colspan=\"2\" | Step ratio\n"