Module:Ups and downs sharpness: Difference between revisions
Jump to navigation
Jump to search
Tristanbay (talk | contribs) More size changes |
Tristanbay (talk | contribs) Changed sizes |
||
| Line 48: | Line 48: | ||
tab = tab .. "[[File:Heji25.svg|12px]]" | tab = tab .. "[[File:Heji25.svg|12px]]" | ||
elseif math.ceil((i / sharp) - 0.5) == 2 then | elseif math.ceil((i / sharp) - 0.5) == 2 then | ||
tab = tab .. "[[File:Heji32.svg| | tab = tab .. "[[File:Heji32.svg|16px]]" | ||
end | end | ||
tab = tab .. "}}\n" | tab = tab .. "}}\n" | ||
| Line 79: | Line 79: | ||
end | end | ||
if math.ceil((i / sharp) - 0.5) == 1 then | if math.ceil((i / sharp) - 0.5) == 1 then | ||
tab = tab .. "[[File:Heji11.svg| | tab = tab .. "[[File:Heji11.svg|12px]]" | ||
elseif math.ceil((i / sharp) - 0.5) == 2 then | elseif math.ceil((i / sharp) - 0.5) == 2 then | ||
tab = tab .. "[[File:Heji4.svg|20px]]" | tab = tab .. "[[File:Heji4.svg|20px]]" | ||
Revision as of 01:58, 23 September 2025
- This module should not be invoked directly; use its corresponding template instead: Template:Ups and downs sharpness.
This module automatically creates a table with the combinations of symbols to notate a given edo using Kite's ups and downs notation.
| Introspection summary for Module:Ups and downs sharpness | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
| ||||||||||||
No function descriptions were provided. The Lua code may have further information.
-- unfinished module!
local p = {}
local utils = require("Module:Utils")
-- calculate amount of steps for sharp/flat
local function sharp_n(edo)
return (7 * math.floor((edo * math.log(3) / math.log(2)) + 0.5)) - (11 * edo) -- mapping of augmented unison
end
-- generate table
function p.ud_sharpness(frame)
local sharp = sharp_n(frame.args["edo"])
local tab = "{|class=\"wikitable\"\n|+\n!Step offset\n|'''0'''\n"
for i = 1, sharp * 2 + 1 do
if (i % sharp == 0) then
tab = tab .. "|'''" .. i .. "'''\n"
else
tab = tab .. "|" .. i .. "\n"
end
end
tab = tab .. "|-\n!Sharp symbol\n|rowspan=\"2\"|[[File:Heji18.svg|12px]]\n"
for i = 1, sharp * 2 + 1 do
tab = tab .. "|{{nowrap|"
if ((i - (sharp * math.floor(i / sharp))) / sharp) > math.ceil(((i - (sharp * math.floor(i / sharp))) / sharp) - 0.5) then
if (i - (sharp * math.floor(i / sharp))) % 5 == 4 then
tab = tab .. "[[File:Down narrow.svg|8px]][[File:Quip narrow.svg|8px]]"
else
for j = 1, (i - (sharp * math.floor(i / sharp))) % 5 do
tab = tab .. "[[File:Up narrow.svg|8px]]"
end
end
for j = 1, math.floor((i - (sharp * math.floor(i / sharp))) / 5) do
tab = tab .. "[[File:Quip narrow.svg|8px]]"
end
else
if ((sharp * math.ceil(i / sharp)) - i) % 5 == 4 then
tab = tab .. "[[File:Up narrow.svg|8px]][[File:Quid narrow.svg|8px]]"
else
for j = 1, ((sharp * math.ceil(i / sharp)) - i) % 5 do
tab = tab .. "[[File:Down narrow.svg|8px]]"
end
end
for j = 1, math.floor(((sharp * math.ceil(i / sharp)) - i) / 5) do
tab = tab .. "[[File:Quid narrow.svg|8px]]"
end
end
if math.ceil((i / sharp) - 0.5) == 1 then
tab = tab .. "[[File:Heji25.svg|12px]]"
elseif math.ceil((i / sharp) - 0.5) == 2 then
tab = tab .. "[[File:Heji32.svg|16px]]"
end
tab = tab .. "}}\n"
end
tab = tab .. "|-\n!Flat symbol\n"
for i = 1, sharp * 2 + 1 do
tab = tab .. "|{{nowrap|"
if ((i - (sharp * math.floor(i / sharp))) / sharp) > math.ceil(((i - (sharp * math.floor(i / sharp))) / sharp) - 0.5) then
if (i - (sharp * math.floor(i / sharp))) % 5 == 4 then
tab = tab .. "[[File:Up narrow.svg|8px]][[File:Quid narrow.svg|8px]]"
else
for j = 1, (i - (sharp * math.floor(i / sharp))) % 5 do
tab = tab .. "[[File:Down narrow.svg|8px]]"
end
end
for j = 1, math.floor((i - (sharp * math.floor(i / sharp))) / 5) do
tab = tab .. "[[File:Quid narrow.svg|8px]]"
end
else
if ((sharp * math.ceil(i / sharp)) - i) % 5 == 4 then
tab = tab .. "[[File:Down narrow.svg|8px]][[File:Quip narrow.svg|8px]]"
else
for j = 1, ((sharp * math.ceil(i / sharp)) - i) % 5 do
tab = tab .. "[[File:Up narrow.svg|8px]]"
end
end
for j = 1, math.floor(((sharp * math.ceil(i / sharp)) - i) / 5) do
tab = tab .. "[[File:Quip narrow.svg|8px]]"
end
end
if math.ceil((i / sharp) - 0.5) == 1 then
tab = tab .. "[[File:Heji11.svg|12px]]"
elseif math.ceil((i / sharp) - 0.5) == 2 then
tab = tab .. "[[File:Heji4.svg|20px]]"
end
tab = tab .. "}}\n"
end
tab = tab .. "|}"
return tab
end
return p