Module:MOS: Difference between revisions
Reclassify functions; added mode rotation function; added arbitrary mode function; added function to negate an interval; simplified code for a few cent functions |
Added step matrix function |
||
| Line 182: | Line 182: | ||
local second = string.sub(mode_string, shift_amt + 1, #mode_string) | local second = string.sub(mode_string, shift_amt + 1, #mode_string) | ||
return second .. first | return second .. first | ||
end | |||
-- Convert a mode (as a string of steps) into a step matrix. | |||
function p.mode_to_step_matrix(mode_string) | |||
local matrix = {} | |||
for i = 1, #mode_string + 1 do | |||
local steps = i - 1 | |||
local interval = p.interval_from_step_sequence(string.sub(mode_string, 0, steps)) | |||
table.insert(matrix, interval) | |||
end | |||
return matrix | |||
end | end | ||
| Line 608: | Line 619: | ||
--return p.interval_from_mos(p.new(5,2), 4, 1) | --return p.interval_from_mos(p.new(5,2), 4, 1) | ||
--return p.interval_from_step_sequence("LLLdLLc") | --return p.interval_from_step_sequence("LLLdLLc") | ||
return p.mode_from_mos(p.new(5,2), -90673) | --return p.mode_from_mos(p.new(5,2), -90673) | ||
return p.mode_to_step_matrix(p.brightest_mode(p.new(5,4))) | |||
end | end | ||
return p | return p | ||