Module:MOS: Difference between revisions

Inthar (talk | contribs)
No edit summary
Inthar (talk | contribs)
No edit summary
Line 38: Line 38:
function p.brightest_mode(mos)
function p.brightest_mode(mos)
local nL, ns, equave = mos.nL, mos.ns, mos.equave
local nL, ns, equave = mos.nL, mos.ns, mos.equave
local d = gcd(nL, ns)
local d = rat.gcd(nL, ns)
if d > 1 then -- use single period mos, with period as new equave
if d > 1 then -- use single period mos, with period as new equave
return string.rep(p.brightest_mode(MOS.new(nL/d, ns/d, p.backslash_ratio(ET.new(d, equave, nil), 1))), d)
return string.rep(p.brightest_mode(MOS.new(nL/d, ns/d, p.backslash_ratio(ET.new(d, equave, nil), 1))), d)
Line 77: Line 77:
function p.bright_gen(mos) -- Compute the abstract bright generator as a "vector" of L and s steps.
function p.bright_gen(mos) -- Compute the abstract bright generator as a "vector" of L and s steps.
local nL, ns, equave = mos.nL, mos.ns, mos.equave
local nL, ns, equave = mos.nL, mos.ns, mos.equave
local d = gcd(nL, ns)
local d = rat.gcd(nL, ns)
if d > 1 then -- use single period mos, with period as new equave
if d > 1 then -- use single period mos, with period as new equave
return string.rep(p.bright_gen(MOS.new(nL/d, ns/d, p.backslash_ratio(ET.new(d, equave, nil), 1))), d)
return string.rep(p.bright_gen(MOS.new(nL/d, ns/d, p.backslash_ratio(ET.new(d, equave, nil), 1))), d)