Module:Interval table: Difference between revisions

Quick fix to unify the precision of cent values
Swap "approximte ratios" and "ups and downs notation" columns
Line 5: Line 5:
local ET = require("Module:ET")
local ET = require("Module:ET")


-- Gets mapping of a monzo in a val
-- Gets mapping of a monzo in a val
local function mapping(monzo, val)
local function mapping(monzo, val)
local result = 0
local result = 0
Line 94: Line 94:


wikitext = t_head ..  
wikitext = t_head ..  
"! Steps\n"..  
"! Steps\n" ..  
"! Cents\n"
"! Cents\n" ..
"! Approximate Ratios\n"
if rat.eq(et.equave, 2) then
if rat.eq(et.equave, 2) then
if dual_fifth then
if dual_fifth then
Line 114: Line 115:
end
end
end
end
 
wikitext = wikitext .. "! Approximate Ratios\n"
 
if #additional_split > 0 then
if #additional_split > 0 then
for i = 1, #additional_split[1] do
for i = 1, #additional_split[1] do
Line 127: Line 126:
wikitext = wikitext .. "|" .. i .. "\n"
wikitext = wikitext .. "|" .. i .. "\n"
wikitext = wikitext .. "|" .. utils._round_dec(ET.cents(et, i), 3) .. "\n"
wikitext = wikitext .. "|" .. utils._round_dec(ET.cents(et, i), 3) .. "\n"
if rat.eq(et.equave, 2) then
if dual_fifth then
wikitext = wikitext .. "|" .. ud_note(et, dual_flat_fifth, i) .. "\n"
wikitext = wikitext .. "|" .. ud_note(et, dual_sharp_fifth, i) .. "\n"
else
wikitext = wikitext .. "|" .. ud_note(et, fifth, i) .. "\n"
end
end
wikitext = wikitext .. "|"
wikitext = wikitext .. "|"
for j = 1, #ratios_list do
for j = 1, #ratios_list do
-- Go through all ratios.
-- Go through all ratios.
-- If they are mapped to the current step in the ET's patent val and <2/5 edo step error,
-- If they are mapped to the current step in the ET's patent val and < 2/5 edostep error,
-- add to approximate ratios column.
-- add to approximate ratios column.
local t = mapping(rat.new(ratios_list[j][1], ratios_list[j][2]), patent_val)
local t = mapping(rat.new(ratios_list[j][1], ratios_list[j][2]), patent_val)
Line 149: Line 140:
end
end
end
end
if rat.eq(et.equave, 2) then
if dual_fifth then
wikitext = wikitext .. "|" .. ud_note(et, dual_flat_fifth, i) .. "\n"
wikitext = wikitext .. "|" .. ud_note(et, dual_sharp_fifth, i) .. "\n"
else
wikitext = wikitext .. "|" .. ud_note(et, fifth, i) .. "\n"
end
end
-- ???
if wikitext:sub(-1, -1) == "|" then
if wikitext:sub(-1, -1) == "|" then
wikitext = wikitext .. "\n"
wikitext = wikitext .. "\n"