Module:Infobox chord: Difference between revisions
Use CSS markup instead of special whitespaces |
Don't hardcode values |
||
| Line 93: | Line 93: | ||
local denom = root / gcd | local denom = root / gcd | ||
table.insert(root_interval_links, "[[" .. numer .. "/" .. denom .. "]]") | table.insert(root_interval_links, "[[" .. numer .. "/" .. denom .. "]]") | ||
-- compute ratio of this harmonic relative to the previous | -- compute ratio of this harmonic relative to the previous | ||
if i > 1 then | if i > 1 then | ||
local prev = harmonics[i-1] | local prev = harmonics[i - 1] | ||
local step_gcd = utils._gcd(h, prev) | local step_gcd = utils._gcd(h, prev) | ||
local step_numer = h / step_gcd | local step_numer = h / step_gcd | ||
local step_denom = prev / step_gcd | local step_denom = prev / step_gcd | ||
table.insert(step_interval_links, "[[" .. step_numer .. "/" .. step_denom .. "]]") | table.insert(step_interval_links, "[[" .. step_numer .. "/" .. step_denom .. "]]") | ||
table.insert(step_cents, utils._round_dec( | table.insert(step_cents, utils._round_dec(1200*utils.log2(step_numer/step_denom)) .. "¢") | ||
end | end | ||
table.insert(root_cents_steps, utils._round_dec( | table.insert(root_cents_steps, utils._round_dec(1200*utils.log2(numer/denom)) .. "¢") | ||
end | end | ||