Module:JI ratios in ED: Difference between revisions

Ganaram inukshuk (talk | contribs)
mNo edit summary
Ganaram inukshuk (talk | contribs)
mNo edit summary
Line 50: Line 50:
local edstep = i - 1
local edstep = i - 1
local edstep_in_cents = (edstep / ed) * equave_in_cents
local edstep_in_cents = (edstep / ed) * equave_in_cents
local filtered_ratios = jiraf.filter_ratios_by_range(candidate_ratios, edstep_in_cents - tolerance, edstep_in_cents + tolerance)
local filtered_ratios = {}
-- Override ratios for edsteps for the unison and equave
-- Otherwise, filter ratios by range
if edstep == 0 then
filtered_ratios = { rat.new(1, 1) }
elseif edstep == ed then
filtered_ratios = { rat.copy(equave) }
else
filtered_ratios = jiraf.filter_ratios_by_range(candidate_ratios, edstep_in_cents - tolerance, edstep_in_cents + tolerance)
end
result = result .. string.format('| %d\n', edstep)
result = result .. string.format('| %d\n', edstep)
Line 66: Line 76:
else
else
prime_filtered_ratios = jiraf.filter_ratios_by_harmonic_class(filtered_ratios, current_prime)
prime_filtered_ratios = jiraf.filter_ratios_by_harmonic_class(filtered_ratios, current_prime)
end
-- Override ratios for edsteps for the unison and equave
if edstep == 0 then
prime_filtered_ratios = { rat.new(1, 1) }
elseif edstep == ed then
prime_filtered_ratios = { rat.copy(equave) }
end
end