Module:JI ratio finder: Difference between revisions
m Fixed nbsp |
Added no-equave-factors-tenney-height |
||
Line 14: | Line 14: | ||
local comp = p.equave_complement(ratio, equave) | local comp = p.equave_complement(ratio, equave) | ||
return math.min(rat.tenney_height(ratio), rat.tenney_height(comp)) | return math.min(rat.tenney_height(ratio), rat.tenney_height(comp)) | ||
end | |||
-- Finds the Tenney height of a ratio that ignores equave factors. | |||
-- If the equave is 2/1, then this is equivalent to no-2's Tenney Height. | |||
-- This is an attempt at generalizing no-2's Tenney height for nonoctave | |||
-- equaves, such as 3/1 or 3/2. | |||
function p.no_equave_factors_tenney_height(ratio, equave) | |||
local ratio = ratio or rat.new(81, 64) | |||
local equave = equave or rat.new(2) | |||
for key, value in pairs(equave) do | |||
if tonumber(key) ~= nil and ratio[key] ~= nil then | |||
ratio[key] = 0 | |||
end | |||
end | |||
return rat.tenney_height(ratio) | |||
end | end | ||