Module:MOS: Difference between revisions

Ganaram inukshuk (talk | contribs)
Bugfixes; added functions to produce step matrices (listings of every mode's listings of interval vectors)
Ganaram inukshuk (talk | contribs)
m mode_from_mos() goes by bright generators going up
Line 173: Line 173:


-- Given a mos, return a mode based on how it's ranked by modal brightness.
-- Given a mos, return a mode based on how it's ranked by modal brightness.
-- 0 is brightest, 1 is 2nd-brightest, 2 is 3rd-brightest, etc... These values
-- Brightness counts down from the maximum number of generators going up (one
-- can be thought of as rotate amounts (for p.rotate_mode()), where the size of
-- less from the period step count), so p-1 is the brightest mode, p-2 the  
-- the bright gen is a multiplier, so the kth brightest mode rotates the
-- second brightest, ... , and 0 the darkest mode.
-- brightest mode k * g times (where g is the size of the generator).
function p.mode_from_mos(mos, bright_gens_going_up)
function p.mode_from_mos(mos, brightness)
return p.rotate_mode(p.brightest_mode(mos), -bright_gens_going_up * p.dark_gen_step_count(mos))
return p.rotate_mode(p.brightest_mode(mos), brightness * p.bright_gen_step_count(mos))
end
end


Line 693: Line 692:
--return p.mode_to_step_matrix(p.brightest_mode(p.new(5,4)))
--return p.mode_to_step_matrix(p.brightest_mode(p.new(5,4)))
--return p.mode_rotations("LssLLssL")
--return p.mode_rotations("LssLLssL")
return p.mode_rotations_to_step_matrices("LLsLsAs")
--return p.mode_rotations_to_step_matrices("LLsLsAs")
--return p.mode_from_mos(p.new(5,2),1)
local string_return = ""
for i = 1, 7 do
string_return = string_return .. p.mode_from_mos(p.new(5,2), i-1) .. "\n"
end
return string_return
end
end


return p
return p