Module:Infobox regtemp: Difference between revisions
Fewer parentheses |
Preliminary cleanup |
||
| Line 38: | Line 38: | ||
local data = {} | local data = {} | ||
table.insert(data, { | table.insert(data, { | ||
"Subgroups", | "Subgroups", | ||
| Line 55: | Line 52: | ||
"⟨" .. mapping .. "]" | "⟨" .. mapping .. "]" | ||
}) | }) | ||
-- | -- process mapping | ||
local map = {} | |||
for num in mapping:gmatch("(%d+); ") do | for num in mapping:gmatch("(%d+); ") do | ||
table.insert(map, num) | table.insert(map, num) | ||
end | end | ||
local | local lowermap = {} | ||
for num in mapping:gmatch("(%d+) ") do | for num in mapping:gmatch("(%d+) ") do | ||
table.insert(lowermap, num) | table.insert(lowermap, num) | ||
end | end | ||
-- autocalculating ploidacot | |||
local ploid = tonumber (map[1]) | |||
local equave = string.char(string.byte(subgroup, 1)) | local equave = string.char(string.byte(subgroup, 1)) | ||
| Line 101: | Line 101: | ||
end | end | ||
local | local equave_size = 1200 * u.log2(tonumber(equave)) | ||
local | local period_size = equave_size / ploid | ||
local generator_size = tonumber(tuning) | |||
if cot < 0 then | if cot < 0 then | ||
generator_size = equave_size - generator_size | |||
cot = math.abs(cot) | cot = math.abs(cot) | ||
end | end | ||
local shear = math.floor( | local shear = math.floor(generator_size*cot/period_size) | ||
shear = math.floor(cot*(shear/cot - math.floor(shear/cot))) | shear = math.floor(cot*(shear/cot - math.floor(shear/cot))) | ||
if cot > 2 | if cot > 2 and shear == cot - 1 then | ||
shear = -1 | shear = -1 | ||
end | end | ||
suffix = p.num2greeklet(tostring(shear)) .. p.num2greek(tostring(cot), "cot") .. suffix | suffix = p.num2greeklet(tostring(shear)) .. p.num2greek(tostring(cot), "cot") .. suffix | ||
if ploid ~= | if ploid ~= 1 then | ||
suffix = p.num2greek(ploid,"ploid") .. "ploid " .. suffix | suffix = p.num2greek(tostring(ploid), "ploid") .. "ploid " .. suffix | ||
end | end | ||
| Line 127: | Line 126: | ||
table.insert(data, { | table.insert(data, { | ||
"Edo join", | "Edo join", | ||
"[[" .. edo_first .. "ed" .. equave_letter .. "|" .. edo_first .. "]] & | "[[" .. edo_first .. "ed" .. equave_letter .. "|" .. edo_first .. "]] & [[" .. edo_second .. "ed" .. equave_letter .. "|" .. edo_second .. "]]" | ||
}) | }) | ||