Module:MOS tunings: Difference between revisions
m Ratios above 2/1 are now only added if they're within the integer limit |
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 = | for j = 1, num_octaves_up do | ||
for i = 2, #ratios do | |||
local num = ratios[i][1] * math.pow(2, j+1) | |||
local den = ratios[i][2] | |||
local gcd = utils._gcd(num, den) | |||
num = num / gcd | |||
den = den / gcd | |||
if math.max(num, den) <= integer_limit then | |||
table.insert(new_ratios, {num, den}) | |||
end | |||
end | end | ||
end | end | ||