Module:TAMNAMS: Difference between revisions
If an empty string is entered into the verify prefix/abbrev functions for a mos outside the tamnams named range, it'll default to mos/m |
ArrowHead294 (talk | contribs) mNo edit summary |
||
| Line 1: | Line 1: | ||
-- Module for TAMNAMS-related things as it pertains to mosses | -- Module for TAMNAMS-related things as it pertains to mosses | ||
-- This module is meant to be used with other modules, not as part of a template | -- This module is meant to be used with other modules, not as part of a template | ||
local mos = require( | local mos = require("Module:MOS") | ||
local rat = require( | local rat = require("Module:Rational") | ||
local p = {} | local p = {} | ||
| Line 21: | Line 21: | ||
-- Lookup table for tamnams step ratios | -- Lookup table for tamnams step ratios | ||
p.step_ratios = { | p.step_ratios = { | ||
[ | ["1:1"] = "equalized", | ||
[ | ["4:3"] = "supersoft", | ||
[ | ["3:2"] = "soft", | ||
[ | ["5:3"] = "semisoft", | ||
[ | ["2:1"] = "basic", | ||
[ | ["5:2"] = "semihard", | ||
[ | ["3:1"] = "hard", | ||
[ | ["4:1"] = "superhard", | ||
[ | ["1:0"] = "collapsed" | ||
} | } | ||
-- And step ratio ranges | -- And step ratio ranges | ||
p.step_ratio_ranges = { | p.step_ratio_ranges = { | ||
[ | ["1:1 to 2:1"] = "soft-of-basic", | ||
[ | ["1:1 to 3:2"] = "soft", | ||
[ | ["1:1 to 4:3"] = "ultrasoft", | ||
[ | ["4:3 to 3:2"] = "parasoft", | ||
[ | ["3:2 to 2:1"] = "hyposoft", | ||
[ | ["3:2 to 5:3"] = "quasisoft", | ||
[ | ["5:3 to 2:1"] = "minisoft", | ||
[ | ["2:1 to 5:2"] = "minihard", | ||
[ | ["5:2 to 3:1"] = "quasihard", | ||
[ | ["2:1 to 3:1"] = "hypohard", | ||
[ | ["3:1 to 4:1"] = "parahard", | ||
[ | ["4:1 to 1:0"] = "ultrahard", | ||
[ | ["3:1 to 1:0"] = "hard", | ||
[ | ["2:1 to 1:0"] = "hard-of-basic" | ||
} | } | ||
-- Lookup table for tamnams extended step ratios | -- Lookup table for tamnams extended step ratios | ||
p.step_ratios_ext = { | p.step_ratios_ext = { | ||
[ | ["1:1"] = "equalized", | ||
[ | ["6:5"] = "semiequalized", | ||
[ | ["4:3"] = "supersoft", | ||
[ | ["3:2"] = "soft", | ||
[ | ["5:3"] = "semisoft", | ||
[ | ["2:1"] = "basic", | ||
[ | ["5:2"] = "semihard", | ||
[ | ["3:1"] = "hard", | ||
[ | ["4:1"] = "superhard", | ||
[ | ["6:1"] = "extrahard", | ||
[ | ["10:1"] = "semicollapsed", | ||
[ | ["1:0"] = "collapsed" | ||
} | } | ||
-- And extended step ratio ranges | -- And extended step ratio ranges | ||
p.step_ratio_ranges_ext = { | p.step_ratio_ranges_ext = { | ||
[ | ["1:1 to 2:1"] = "soft-of-basic", | ||
[ | ["1:1 to 3:2"] = "soft", | ||
[ | ["1:1 to 6:5"] = "pseudoequalized", | ||
[ | ["6:5 to 4:3"] = "ultrasoft", | ||
[ | ["4:3 to 3:2"] = "parasoft", | ||
[ | ["3:2 to 2:1"] = "hyposoft", | ||
[ | ["3:2 to 5:3"] = "quasisoft", | ||
[ | ["5:3 to 2:1"] = "minisoft", | ||
[ | ["2:1 to 5:2"] = "minihard", | ||
[ | ["5:2 to 3:1"] = "quasihard", | ||
[ | ["2:1 to 3:1"] = "hypohard", | ||
[ | ["3:1 to 4:1"] = "parahard", | ||
[ | ["4:1 to 6:1"] = "hyperhard", | ||
[ | ["6:1 to 10:1"] = "clustered", | ||
[ | ["4:1 to 10:1"] = "ultrahard", | ||
[ | ["10:1 to 1:0"] = "pseudocollapsed", | ||
[ | ["3:1 to 1:0"] = "hard", | ||
[ | ["2:1 to 1:0"] = "hard-of-basic" | ||
} | } | ||
-- Lookup table for tamnams names within the range of 6-10 steps | -- Lookup table for tamnams names within the range of 6-10 steps | ||
p.mos_names = { | p.mos_names = { | ||
[ | ["1L 1s"] = "monowood", | ||
[ | ["2L 2s"] = "biwood", | ||
[ | ["1L 5s"] = "antimachinoid", | ||
[ | ["2L 4s"] = "malic", | ||
[ | ["3L 3s"] = "triwood", | ||
[ | ["4L 2s"] = "citric", | ||
[ | ["5L 1s"] = "machinoid", | ||
[ | ["1L 6s"] = "onyx", | ||
[ | ["2L 5s"] = "antidiatonic", | ||
[ | ["3L 4s"] = "mosh", | ||
[ | ["4L 3s"] = "smitonic", | ||
[ | ["5L 2s"] = "diatonic", | ||
[ | ["6L 1s"] = "archaeotonic", | ||
[ | ["1L 7s"] = "antipine", | ||
[ | ["2L 6s"] = "subaric", | ||
[ | ["3L 5s"] = "checkertonic", | ||
[ | ["4L 4s"] = "tetrawood", | ||
[ | ["5L 3s"] = "oneirotonic", | ||
[ | ["6L 2s"] = "ekic", | ||
[ | ["7L 1s"] = "pine", | ||
[ | ["1L 8s"] = "antisubneutralic", | ||
[ | ["2L 7s"] = "balzano", | ||
[ | ["3L 6s"] = "tcherepnin", | ||
[ | ["4L 5s"] = "gramitonic", | ||
[ | ["5L 4s"] = "semiquartal", | ||
[ | ["6L 3s"] = "hyrulic", | ||
[ | ["7L 2s"] = "armotonic", | ||
[ | ["8L 1s"] = "subneutralic", | ||
[ | ["1L 9s"] = "antisinatonic", | ||
[ | ["2L 8s"] = "jaric", | ||
[ | ["3L 7s"] = "sephiroid", | ||
[ | ["4L 6s"] = "lime", | ||
[ | ["5L 5s"] = "pentawood", | ||
[ | ["6L 4s"] = "lemon", | ||
[ | ["7L 3s"] = "dicoid", | ||
[ | ["8L 2s"] = "taric", | ||
[ | ["9L 1s"] = "sinatonic" | ||
} | } | ||
-- And prefixes | -- And prefixes | ||
p.mos_prefixes = { | p.mos_prefixes = { | ||
[ | ["1L 1s"] = "monwd", | ||
[ | ["2L 2s"] = "biwd", | ||
[ | ["1L 5s"] = "amech", | ||
[ | ["2L 4s"] = "mal", | ||
[ | ["3L 3s"] = "triwd", | ||
[ | ["4L 2s"] = "citro", | ||
[ | ["5L 1s"] = "mech", | ||
[ | ["1L 6s"] = "on", | ||
[ | ["2L 5s"] = "pel", | ||
[ | ["3L 4s"] = "mosh", | ||
[ | ["4L 3s"] = "smi", | ||
[ | ["5L 2s"] = "dia", | ||
[ | ["6L 1s"] = "arch", | ||
[ | ["1L 7s"] = "apine", | ||
[ | ["2L 6s"] = "subar", | ||
[ | ["3L 5s"] = "check", | ||
[ | ["4L 4s"] = "tetrawd", | ||
[ | ["5L 3s"] = "oneiro", | ||
[ | ["6L 2s"] = "ek", | ||
[ | ["7L 1s"] = "pine", | ||
[ | ["1L 8s"] = "ablu", | ||
[ | ["2L 7s"] = "bal", | ||
[ | ["3L 6s"] = "cher", | ||
[ | ["4L 5s"] = "gram", | ||
[ | ["5L 4s"] = "cthon", | ||
[ | ["6L 3s"] = "hyru", | ||
[ | ["7L 2s"] = "arm", | ||
[ | ["8L 1s"] = "blu", | ||
[ | ["1L 9s"] = "asina", | ||
[ | ["2L 8s"] = "jara", | ||
[ | ["3L 7s"] = "seph", | ||
[ | ["4L 6s"] = "lime", | ||
[ | ["5L 5s"] = "pentawd", | ||
[ | ["6L 4s"] = "lem", | ||
[ | ["7L 3s"] = "dico", | ||
[ | ["8L 2s"] = "tara", | ||
[ | ["9L 1s"] = "sina" | ||
} | } | ||
-- And abbrevs | -- And abbrevs | ||
p.mos_abbrevs = { | p.mos_abbrevs = { | ||
[ | ["1L 1s"] = "w", | ||
[ | ["2L 2s"] = "bw", | ||
[ | ["1L 5s"] = "amk", | ||
[ | ["2L 4s"] = "mal", | ||
[ | ["3L 3s"] = "tw", | ||
[ | ["4L 2s"] = "cit", | ||
[ | ["5L 1s"] = "mk", | ||
[ | ["1L 6s"] = "on", | ||
[ | ["2L 5s"] = "pel", | ||
[ | ["3L 4s"] = "mosh", | ||
[ | ["4L 3s"] = "smi", | ||
[ | ["5L 2s"] = "dia", | ||
[ | ["6L 1s"] = "arc", | ||
[ | ["1L 7s"] = "ap", | ||
[ | ["2L 6s"] = "sb", | ||
[ | ["3L 5s"] = "chk", | ||
[ | ["4L 4s"] = "ttw", | ||
[ | ["5L 3s"] = "onei", | ||
[ | ["6L 2s"] = "ek", | ||
[ | ["7L 1s"] = "p", | ||
[ | ["1L 8s"] = "ablu", | ||
[ | ["2L 7s"] = "bz", | ||
[ | ["3L 6s"] = "ch", | ||
[ | ["4L 5s"] = "gm", | ||
[ | ["5L 4s"] = "ct", | ||
[ | ["6L 3s"] = "hy", | ||
[ | ["7L 2s"] = "arm", | ||
[ | ["8L 1s"] = "blu", | ||
[ | ["1L 9s"] = "asi", | ||
[ | ["2L 8s"] = "ja", | ||
[ | ["3L 7s"] = "sp", | ||
[ | ["4L 6s"] = "lm", | ||
[ | ["5L 5s"] = "pw", | ||
[ | ["6L 4s"] = "le", | ||
[ | ["7L 3s"] = "di", | ||
[ | ["8L 2s"] = "ta", | ||
[ | ["9L 1s"] = "si" | ||
} | } | ||
-- TAMNAMS equave-agnostic names | -- TAMNAMS equave-agnostic names | ||
p.equave_agnostic_names = { | p.equave_agnostic_names = { | ||
[ | ["1L 1s"] = "trivial", | ||
[ | ["1L 2s"] = "antrial", | ||
[ | ["2L 1s"] = "trial", | ||
[ | ["1L 3s"] = "antetric", | ||
[ | ["3L 1s"] = "tetric", | ||
[ | ["1L 4s"] = "pedal", | ||
[ | ["2L 3s"] = "pentic", | ||
[ | ["3L 2s"] = "anpentic", | ||
[ | ["4L 1s"] = "manual" | ||
} | } | ||
-- And prefixes | -- And prefixes | ||
p.equave_agnostic_prefixes = { | p.equave_agnostic_prefixes = { | ||
[ | ["1L 1s"] = "trv", | ||
[ | ["1L 2s"] = "at", | ||
[ | ["2L 1s"] = "t", | ||
[ | ["1L 3s"] = "att", | ||
[ | ["3L 1s"] = "tt", | ||
[ | ["1L 4s"] = "pd", | ||
[ | ["2L 3s"] = "pt", | ||
[ | ["3L 2s"] = "apt", | ||
[ | ["4L 1s"] = "mnu" | ||
} | } | ||
-- And abbrevs | -- And abbrevs | ||
p.equave_agnostic_abbrevs = { | p.equave_agnostic_abbrevs = { | ||
[ | ["1L 1s"] = "trv", | ||
[ | ["1L 2s"] = "at", | ||
[ | ["2L 1s"] = "t", | ||
[ | ["1L 3s"] = "att", | ||
[ | ["3L 1s"] = "tt", | ||
[ | ["1L 4s"] = "ped", | ||
[ | ["2L 3s"] = "pt", | ||
[ | ["3L 2s"] = "apt", | ||
[ | ["4L 1s"] = "mnu" | ||
} | } | ||
| Line 261: | Line 261: | ||
if type(step_ratio) == "string" then | if type(step_ratio) == "string" then | ||
return step_ratio | return step_ratio | ||
elseif (type(step_ratio) == "table" and type(step_ratio[1]) == | elseif (type(step_ratio) == "table" and type(step_ratio[1]) == "number" and type(step_ratio[2]) == "number") then | ||
return rat.new(step_ratio[1], step_ratio[2]) | return rat.new(step_ratio[1], step_ratio[2]) | ||
else | else | ||
| Line 346: | Line 346: | ||
-- Produce the key needed to lookup the step ratio name | -- Produce the key needed to lookup the step ratio name | ||
-- use_extended is used to toggle between central range and extended range | -- use_extended is used to toggle between central range and extended range | ||
local key = rat.as_ratio(step_ratio, | local key = rat.as_ratio(step_ratio, ":") | ||
local named_ratio = use_extended and p.step_ratios_ext[key] or p.step_ratios[key] | local named_ratio = use_extended and p.step_ratios_ext[key] or p.step_ratios[key] | ||
| Line 365: | Line 365: | ||
local float_2 = rat.as_float(step_ratio_2) | local float_2 = rat.as_float(step_ratio_2) | ||
if (float_1 > float_2) then | if (float_1 > float_2) then | ||
key = string.format( | key = string.format("%s to %s", rat.as_ratio(step_ratio_2, ":"), rat.as_ratio(step_ratio_1, ":")) | ||
else | else | ||
key = string.format( | key = string.format("%s to %s", rat.as_ratio(step_ratio_1, ":"), rat.as_ratio(step_ratio_2, ":")) | ||
end | end | ||
| Line 730: | Line 730: | ||
end | end | ||
if periods == 1 then | if periods == 1 then | ||
return string.format("%s& | return string.format("%s {{pipe}} %s", gens_up_per_period, gens_down_per_period) .. alterations_as_string | ||
else | else | ||
return string.format("%s& | return string.format("%s {{pipe}} %s(%s)", gens_up_per_period * periods, gens_down_per_period * periods, periods) .. alterations_as_string | ||
end | end | ||
end | end | ||