Module:MOS: Difference between revisions

Inthar (talk | contribs)
"Diminished" and "superdiatonic" are no longer recommended in TAMNAMS.
Ganaram inukshuk (talk | contribs)
Added ancestor-finder function (simplified version of that used by the mos intro)
Line 197: Line 197:
return et, gen_steps
return et, gen_steps
end
end
-- Given a mos, find the ancestor mos with a target note count (default 10)
-- or less
function p.find_ancestor(mos, target_note_count)
local mos = mos or p.new(5, 2)
local target_note_count = target_note_count or 10
local z = mos.nL
local w = mos.ns
while (z ~= w) and (z + w > target_note_count) do
local m1 = math.max(z, w)
local m2 = math.min(z, w)
-- For use with updating ancestor mos chunks
local z_prev = z
-- Update step ratios
z = m2
w = m1 - m2
end
return p.new(z, w, mos.equave)
end
return p
return p