Module:Ups and downs sharpness: Difference between revisions
Tristanbay (talk | contribs) mNo edit summary |
Tristanbay (talk | contribs) Should work now; the code is a bit messy and the table formatting could be nicer though |
||
| Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
local utils = require("Module:Utils") | local utils = require("Module:Utils") | ||
-- calculate amount of steps for sharp/flat | local function sharp_n(edo) -- calculate amount of steps for sharp/flat | ||
return (7 * math.floor((edo * math.log(3) / math.log(2)) + 0.5)) - (11 * edo) -- mapping of augmented unison | return (7 * math.floor((edo * math.log(3) / math.log(2)) + 0.5)) - (11 * edo) -- mapping of augmented unison | ||
end | end | ||
function p.ud_sharpness(frame) -- generate table | |||
function p.ud_sharpness(frame) | |||
local sharp = sharp_n(frame.args["edo"]) | local sharp = sharp_n(frame.args["edo"]) | ||
local tab = "{|class=\"wikitable\"\n|+\n!Step offset\n|'''0'''\n" | local tab = "{|class=\"wikitable\"\n|+\n!Step offset\n|'''0'''\n" | ||
| Line 19: | Line 16: | ||
end | end | ||
end | end | ||
tab = tab .. "|-\n!Sharp symbol\n|rowspan=\"2\"|[[File:Heji18.svg| | tab = tab .. "|-\n!Sharp symbol\n|rowspan=\"2\"|[[File:Heji18.svg|15px]]\n" | ||
for i = 1, sharp * 2 + 1 do | for i = 1, sharp * 2 + 1 do | ||
tab = tab .. "|" | tab = tab .. "|" | ||