Module:TAMNAMS: Difference between revisions
Added equave-agnostic names (even though their use is currently limited) |
Added mos_abbrev param for mode_udp and mode_rotation_udps functions |
||
| Line 719: | Line 719: | ||
-- NOTES: | -- NOTES: | ||
-- - It's advised to use this for modmosses as this is less efficient if | -- - It's advised to use this for modmosses as this is less efficient if | ||
-- used on true-mos modes. | -- used on true-mos modes. Conversely, since modal brightness doesn't make | ||
-- much sense for modmosses, it's advised to use this for modmosses. | |||
-- - There will always be as many modes as there are steps in a period of | -- - 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 | -- repetition, even if a modmos's period of repetition spans more than one | ||
| Line 727: | Line 728: | ||
-- period of repetition is needed, as other modes reached by rotation after | -- period of repetition is needed, as other modes reached by rotation after | ||
-- that are literally redendant. | -- that are literally redendant. | ||
function p.mode_rotation_udps(input_mode, input_mos) | function p.mode_rotation_udps(input_mode, input_mos, mos_abbrev) | ||
local modes = mos.mode_rotations(input_mode) | local modes = mos.mode_rotations(input_mode) | ||
local udps = {} | local udps = {} | ||
for i = 1, #modes do | for i = 1, #modes do | ||
table.insert(udps, p.mode_udp(modes[i], input_mos)) | table.insert(udps, p.mode_udp(modes[i], input_mos, mos_abbrev)) | ||
end | end | ||
return udps | return udps | ||
| Line 740: | Line 741: | ||
-- Helper function for mode_rotation_udps(). | -- 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. Alterations require a mos abbrev, which is | ||
function p.mode_udp(input_mode, input_mos) | -- automatically looked up, defaulting to "m" if no abbrev can be found. | ||
function p.mode_udp(input_mode, input_mos, mos_abbrev) | |||
local mos_abbrev = mos_abbrev or p.lookup_abbrev(input_mos) or "m" | |||
local true_modes = mos.modes_to_step_matrices(input_mos) | local true_modes = mos.modes_to_step_matrices(input_mos) | ||
local input_mode_as_step_matrix = mos.mode_to_step_matrix(input_mode) | local input_mode_as_step_matrix = mos.mode_to_step_matrix(input_mode) | ||
| Line 792: | Line 795: | ||
if not mos.interval_eq(mode_interval, true_interval) then | if not mos.interval_eq(mode_interval, true_interval) then | ||
altered_degree = p.degree_quality(mode_interval, input_mos, "ABBREV") | altered_degree = p.degree_quality(mode_interval, input_mos, "ABBREV", mos_abbrev) | ||
alterations = alterations .. " " .. altered_degree | alterations = alterations .. " " .. altered_degree | ||
end | end | ||
| Line 814: | Line 817: | ||
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("LLsLsAs", mos.new(5,2)) | return p.mode_rotation_udps("LLsLsAs", mos.new(5,2), "m") | ||
--return p.degree_quality({4, -1}, mos.new(5,2), "ABBREV", 'm') | |||
end | end | ||
return p | return p | ||