Module:Keyboard: Difference between revisions

Plumtree (talk | contribs)
mNo edit summary
Plumtree (talk | contribs)
mNo edit summary
Line 4: Line 4:
function p.ET(frame)
function p.ET(frame)
local et = ET.parse(frame.args[1])
local et = ET.parse(frame.args[1])
local from = tonumber(frame.args['From']) or 1
local from = tonumber(frame.args['From']) or 0
local to = tonumber(frame.args['To']) or et.size
local to = tonumber(frame.args['To']) or et.size - 1
local base_freq = tonumber(frame.args['Base frequency']) or 440
local base_freq = tonumber(frame.args['Base frequency']) or 440
Line 68: Line 68:
local hz = 2 ^ (math.log(base_freq)/math.log(2) + cents/1200)
local hz = 2 ^ (math.log(base_freq)/math.log(2) + cents/1200)
table.insert(freqs, hz)
table.insert(freqs, hz)
local j = (i - 1) % et.size + 1
local j = (i % et.size) + 1
colours = colours .. layout:sub(j, j)
colours = colours .. layout:sub(j, j)
end
end