Module:Interval table: Difference between revisions

CompactStar (talk | contribs)
No edit summary
CompactStar (talk | contribs)
No edit summary
Line 69: Line 69:
additional_split[i] = mysplit(additional_split[i], ';')
additional_split[i] = mysplit(additional_split[i], ';')
end
end
local max_error = tonumber(frame.args['max_error'])
local tuning = frame.args['tuning']
local tuning = frame.args['tuning']
local et = ET.parse(tuning) or ET.parse('12edo')
local et = ET.parse(tuning) or ET.parse('12edo')
Line 89: Line 88:
[47] = ET.approximate(et, 47)
[47] = ET.approximate(et, 47)
}
}
 
local wikitext = '{|class="wikitable"\n'
local wikitext = '{|class="wikitable"\n'
local octave = patent_val[2]
local octave = patent_val[2]
Line 119: Line 118:
end
end
end
end


for i=0,et.size do
for i=0,et.size do
Line 134: Line 134:
wikitext = wikitext .. '|'
wikitext = wikitext .. '|'
for j=1,#ratios_list do
for j=1,#ratios_list do
-- Go through all ratios, if they are mapped to the current step in the ET's patent val and <max error, add to approximate ratios column
-- Go through all ratios, if they are mapped to the current step in the ET's patent val and <40 cents error, add to approximate ratios column
t = mapping(u.get_monzo(ratios_list[j][1], ratios_list[j][2]), patent_val)
t = mapping(u.get_monzo(ratios_list[j][1], ratios_list[j][2]), patent_val)
if t == i and math.abs(ET.cents(et, i) - u._log(ratios_list[j][1]/ratios_list[j][2], 2) * 1200) < max_error then
if t == i and math.abs(ET.cents(et, i) - u._log(ratios_list[j][1]/ratios_list[j][2], 2) * 1200) < 40 then
wikitext = wikitext .. '[[' .. ratios_list[j][1] .. '/' .. ratios_list[j][2] .. ']], '
wikitext = wikitext .. '[[' .. ratios_list[j][1] .. '/' .. ratios_list[j][2] .. ']], '
end
end