Module:JI ratios in ED: Difference between revisions

Ganaram inukshuk (talk | contribs)
mNo edit summary
Ganaram inukshuk (talk | contribs)
m Added denominator limit, adjusted tolerance
Line 6: Line 6:
local p = {}
local p = {}


function p.find_ratios_in_ed_by_primes(ed, primes, int_limit, equave, tenney_height)
function p.find_ratios_in_ed_by_primes(ed, primes, int_limit, equave, tenney_height, denominator_limit)
local ed = ed or 12
local ed = ed or 12
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(2, 1)
local tenney_height = tenney_height or 10
local tenney_height = tenney_height or 10
local denominator_limit = denominator_limit or 99
local equave_in_cents = rat.cents(equave)
local equave_in_cents = rat.cents(equave)
local tolerance = equave_in_cents / ed / 3
local tolerance = equave_in_cents / ed * 0.4
-- Find candidate ratios; filter later
-- Find candidate ratios; filter later
local candidate_ratios = jiraf.find_candidate_ratios(equave_in_cents, 99)
local candidate_ratios = jiraf.find_candidate_ratios(equave_in_cents, denominator_limit)
-- Equave as text
-- Equave as text
Line 116: Line 117:
local tenney_height = tonumber(frame.args["Tenney Height"]) or 10
local tenney_height = tonumber(frame.args["Tenney Height"]) or 10
local denominator_limit = tonumber(frame.args["Denominator Limit"]) or 99
local result = p.find_ratios_in_ed_by_primes(ed, primes, 99, equave, tenney_height)
local result = p.find_ratios_in_ed_by_primes(ed, primes, 99, equave, tenney_height, denominator_limit)
return result
return result