Module:TAMNAMS: Difference between revisions
Comments; bugfix for udp |
Added udp function that creates a udp as a string; helper function for various udp-related functions |
||
| Line 672: | Line 672: | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
------------------------- MODE NOTATION FUNCTIONS ------------------------------ | ------------------------- MODE NOTATION FUNCTIONS ------------------------------ | ||
-------------------------- BASED ON UDP NOTATION ------------------------------- | |||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
-- Given the number of gens up and down per period and a period count (u, d, and | |||
-- p respectively), construct the UDP as a string, as up|dp(p) or u|d, for | |||
-- multi-period and single-period respectively. | |||
-- If only u is known, then d = p - u - 1. | |||
-- If only d is known, then u = p - d - 1. (Basically, p = u + d + 1.) | |||
function p.udp(gens_up_per_period, gens_down_per_period, periods) | |||
if periods == 1 then | |||
return string.format("%s|%s", gens_up_per_period, gens_down_per_period) | |||
else | |||
return string.format("%s|%s(%s)", gens_up_per_period * periods, gens_down_per_period * periods, periods) | |||
end | |||
end | |||
-- Given an input mos, list the udps for each of its modes, listed in order of | -- Given an input mos, list the udps for each of its modes, listed in order of | ||
| Line 685: | Line 699: | ||
local gens_down = steps_per_period - gens_up - 1 | local gens_down = steps_per_period - gens_up - 1 | ||
local udp = | local udp = p.udp(gens_up, gens_down, period_count) | ||
table.insert(udps, udp) | table.insert(udps, udp) | ||
end | end | ||
| Line 785: | Line 794: | ||
-- period mosses, or u|d for single-period mosses. | -- period mosses, or u|d for single-period mosses. | ||
local period_count = mos.period_count(input_mos) | local period_count = mos.period_count(input_mos) | ||
local | local bright_gens_up_per_period = mos.period_step_count(input_mos) - 1 - bright_gens_down_per_period | ||
udp = | udp = p.udp(bright_gens_up_per_period, bright_gens_down_per_period, period_count) | ||
-- Produce the list of alterations, if the mode is for a modmos. | -- Produce the list of alterations, if the mode is for a modmos. | ||
| Line 824: | Line 828: | ||
output_ = output_ .. "LLsLsAs" .. " " .. p.mode_udp("LLsLsAs", mos.new(5,2)) | output_ = output_ .. "LLsLsAs" .. " " .. p.mode_udp("LLsLsAs", mos.new(5,2)) | ||
return p.mode_rotation_udps(" | return p.mode_rotation_udps("LLLsLLs", mos.new(5,2), "m") | ||
--return p.degree_quality({4, -1}, mos.new(5,2), "ABBREV", 'm') | --return p.degree_quality({4, -1}, mos.new(5,2), "ABBREV", 'm') | ||