Module:JI ratios in ED: Difference between revisions

Ganaram inukshuk (talk | contribs)
mNo edit summary
Ganaram inukshuk (talk | contribs)
m Bugfixing near-equave ratios appearing in equave row
Line 7: Line 7:


function p.find_ratios_in_ed_by_primes(ed, primes, equave, tenney_height, denominator_limit)
function p.find_ratios_in_ed_by_primes(ed, primes, equave, tenney_height, denominator_limit)
local ed = ed or 12
local ed = ed or 7
local primes = primes or { 3, 5, 7, 11, 13, 17, 19 }
local primes = primes or { 3, 5, 7, 11, 13, 17, 19 }
local equave = equave or rat.new(2, 1)
local equave = equave or rat.new(3, 2)
local tenney_height = tenney_height or 10
local tenney_height = tenney_height or 10
local denominator_limit = denominator_limit or 99
local denominator_limit = denominator_limit or 99
Line 54: Line 54:
-- Override ratios for edsteps for the unison and equave
-- Override ratios for edsteps for the unison and equave
-- Otherwise, filter ratios by range
-- Otherwise, filter ratios by range
if edstep == 0 then
if i == 1 or i == ed + 1 then
filtered_ratios = { rat.new(1, 1) }
filtered_ratios = { rat.new(1, 1), rat.copy(equave) }
elseif edstep == ed then
filtered_ratios = { rat.copy(equave) }
else
else
filtered_ratios = jiraf.filter_ratios_by_range(candidate_ratios, edstep_in_cents - tolerance, edstep_in_cents + tolerance)
filtered_ratios = jiraf.filter_ratios_by_range(candidate_ratios, edstep_in_cents - tolerance, edstep_in_cents + tolerance)