Module:TAMNAMS: Difference between revisions

Ganaram inukshuk (talk | contribs)
Added functions that list every mos's mode's udp and cpo
Ganaram inukshuk (talk | contribs)
Added function that finds the udps (plus alterations) for an arbitrary mode's rotations
Line 5: Line 5:
local rat = require('Module:Rational')
local rat = require('Module:Rational')
local utils = require('Module:Utils')
local utils = require('Module:Utils')
local tip = require('Module:Template input parse')
local p = {}
local p = {}


Line 672: Line 673:
end
end
return cpos
return cpos
end
-- Given a string that represents a mode, return the udps for each of its
-- rotations. If the mode is a modmos, the closest mode and its alterations
-- are returned as a string.
-- NOTES:
-- - It's advised to use this for modmosses as this is less efficient if
--  used on true-mos modes.
-- - There will always be as many modes as there are steps in a period of
--  repetition, even if a modmos's period of repetition spans more than one
--  period of the original mos. EG, LLsLsLss and LLssLLss are modmosses of
--  4L 4s (LsLsLsLs), and their periods are 8, 4, and 2 steps respectively,
--  meaning they have 8, 4, and 2 unique modes respectively. Also, only the 1st
--  period of repetition is needed, as other modes reached by rotation after
--  that are literally redendant.
function p.mode_rotation_udps(input_mode, input_mos)
local modes = mos.mode_rotations(input_mode)
local udps = {}
for i = 1, #modes do
table.insert(udps, p.mode_udp(modes[i], input_mos))
end
return udps
end
end


-- Given a string that represents a mode, return its udp.
-- Given a string that represents a mode, return its udp.
-- Helper function for mode_rotation_udps().
-- If a mode is for a modmos, it will return the closest brightest mode followed
-- If a mode is for a modmos, it will return the closest brightest mode followed
-- by its altered scale degrees.
-- by its altered scale degrees.
Line 750: Line 775:
output_ = output_ .. "LLsLsAs" .. " " .. p.mode_udp("LLsLsAs", mos.new(5,2))
output_ = output_ .. "LLsLsAs" .. " " .. p.mode_udp("LLsLsAs", mos.new(5,2))
return p.mos_mode_cpos(mos.new(5,2))
return p.mode_rotation_udps("LLsLsAs", mos.new(5,2))