Module:Harmonics in edo: Difference between revisions
No edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
local f = 1/edo | local f = 1/edo | ||
local todd = {'! | Odd harmonic '} | local todd = {'! | Odd harmonic '} | ||
local tapprox = {'! | Approximation '} | |||
local tabs = {'! | Error ([[cent|¢]]) '} | local tabs = {'! | Error ([[cent|¢]]) '} | ||
local tdeg = {'! | Steps'} | local tdeg = {'! | Steps'} | ||
Line 13: | Line 14: | ||
ev = math.floor(v + .5) | ev = math.floor(v + .5) | ||
table.insert(todd, ' ' .. p .. '/' .. 2^math.floor(s) ) | table.insert(todd, ' ' .. p .. '/' .. 2^math.floor(s) ) | ||
table.insert(todd, 1200*math.round(math.log(p) / math.log(2)*edo)/edo % 1200 ) | |||
table.insert(tabs, string.format(fmt_abs, 1200 * (ev - v ) / edo)) | table.insert(tabs, string.format(fmt_abs, 1200 * (ev - v ) / edo)) | ||
table.insert(tdeg, ' ' .. ev % edo .. ' ') | table.insert(tdeg, ' ' .. ev % edo .. ' ') | ||
Line 25: | Line 27: | ||
'|-\n' .. | '|-\n' .. | ||
table.concat(todd, '\n!') .. '\n' .. | table.concat(todd, '\n!') .. '\n' .. | ||
'|-\n' .. | |||
table.concat(tapprox, '\n|') .. '\n' .. | |||
'|-\n' .. | '|-\n' .. | ||
table.concat(tabs, '\n|') .. '\n' .. | table.concat(tabs, '\n|') .. '\n' .. |