Module:MOS tunings: Difference between revisions

Ganaram inukshuk (talk | contribs)
m Ratios above 2/1 are now only added if they're within the integer limit
Ganaram inukshuk (talk | contribs)
No edit summary
Line 84: Line 84:
local num_octaves_up = -1 + math.floor(max_cents / 1200)
local num_octaves_up = -1 + math.floor(max_cents / 1200)
for i = 1, #ratios do
for j = 1, num_octaves_up do
local num = ratios[i][1] * 2
for i = 2, #ratios do
local den = ratios[i][2]
local num = ratios[i][1] * math.pow(2, j+1)
local den = ratios[i][2]
local gcd = utils._gcd(num, den)
num = num / gcd
local gcd = utils._gcd(num, den)
den = den / gcd
num = num / gcd
den = den / gcd
if math.max(num, den) <= integer_limit then
table.insert(new_ratios, {num, den})
if math.max(num, den) <= integer_limit then
table.insert(new_ratios, {num, den})
end
end
end
end
end