Module:Ups and downs sharpness: Difference between revisions
Jump to navigation
Jump to search
Tristanbay (talk | contribs) removed function for drops and lift calculation (still unfinished) |
Tristanbay (talk | contribs) still unfinished but hopefully this does something now |
||
| Line 9: | Line 9: | ||
-- generate table | -- generate table | ||
function p.ud_sharpness(frame) | |||
local sharp = sharp_n(frame.args["edo"]) | |||
local thead = "{| class=\"wikitable center-all\"\n" | local thead = "{| class=\"wikitable center-all\"\n" | ||
local tlabel = "|-\n! Step offset\n{{!}}'''0'''" | local tlabel = "|-\n! Step offset\n{{!}}'''0'''" | ||
| Line 22: | Line 23: | ||
end | end | ||
end | end | ||
return thead .. table.concat(tlabel, "\n|") .. "\n|}" | return frame:preprocess(thead .. table.concat(tlabel, "\n|") .. "\n|}") | ||
end | end | ||
Revision as of 23:14, 22 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 thead = "{| class=\"wikitable center-all\"\n"
local tlabel = "|-\n! Step offset\n{{!}}'''0'''"
local tsharp = "|-\n! Sharp symbol\n| rowspan=\"2\" | [[File:Heji18.svg|15px]]"
local tflat = "|-\n! Flat symbol"
for i=1, (sharp*2+1) do
if i % sharp == 0 then
table.insert(tlabel, "'''" .. i .. "'''")
else
table.insert(tlabel, "" .. i)
end
end
return frame:preprocess(thead .. table.concat(tlabel, "\n|") .. "\n|}")
end