Module:JI ratios: Difference between revisions

Ganaram inukshuk (talk | contribs)
mNo edit summary
Ganaram inukshuk (talk | contribs)
Updated search-by-params to use new function; will momentarily break dependent modules
Line 269: Line 269:
-- Search for ratios based on params passed in. Each param is its own
-- Search for ratios based on params passed in. Each param is its own
-- function call. Params must be parsed first.
-- function call. Params must be parsed first.
function p.search_by_params(params, max_cents)
function p.search_by_params(params, equave)
local max_cents = max_cents or 1200
local equave = equave or rat.new(2,1)
-- First get ratios up to an int limit. If no int limit was passed in, it
-- First get ratios up to an int limit. If no int limit was passed in, it
Line 276: Line 276:
local ratios = {}
local ratios = {}
if params["Int Limit"] ~= nil then
if params["Int Limit"] ~= nil then
ratios = p.search_by_int_limit(params["Int Limit"], max_cents)
ratios = p.search_by_int_limit_within_equave(params["Int Limit"], equave, params["Tenney Height"])
end
end
if params["Tenney Height"] ~= nil then
ratios = p.filter_by_tenney_height(ratios, params["Tenney Height"])
end
return ratios
return ratios
end
end
Line 296: Line 291:
if parsed["Tenney Height"] ~= nil then
if parsed["Tenney Height"] ~= nil then
parsed["Tenney Height"] = tonumber(parsed["Tenney Height"])
parsed["Tenney Height"] = tonumber(parsed["Tenney Height"])
end
if parsed["Prime Limit"] ~= nil then
parsed["Prime Limit"] = tonumber(parsed["Prime Limit"])
end
end
Line 433: Line 424:
function p.tester()
function p.tester()


local ratios = p.search_by_int_limit_within_equave(30, rat.new(4000,2999))
local ratios = p.search_by_params(p.parse_search_params("Tenney Height: 10; Int Limit: 35"), rat.new(2,1))
return p.ratios_as_text(ratios)
return p.ratios_as_text(ratios)