Module:JI ratios in ED: Difference between revisions
Added default params |
m Bugfixed tolerance, which should be +/- 1/4th of an edstep |
||
| Line 12: | Line 12: | ||
local equave_in_cents = rat.cents(equave) | local equave_in_cents = rat.cents(equave) | ||
local | local tolerance = equave_in_cents / ed / 4 | ||
local candidate_ratios = jiraf.find_candidate_ratios(equave_in_cents, 99) | local candidate_ratios = jiraf.find_candidate_ratios(equave_in_cents, 99) | ||
| Line 34: | Line 34: | ||
local edstep = i - 1 | local edstep = i - 1 | ||
local edstep_in_cents = edstep * equave_in_cents / ed | local edstep_in_cents = edstep * equave_in_cents / ed | ||
local filtered_ratios = jiraf.filter_ratios_by_range(candidate_ratios, edstep_in_cents | local filtered_ratios = jiraf.filter_ratios_by_range(candidate_ratios, edstep_in_cents - tolerance, edstep_in_cents + tolerance) | ||
result = result .. string.format('| %d\n', edstep) | result = result .. string.format('| %d\n', edstep) | ||