Module:Infobox MOS: Difference between revisions
mNo edit summary |
bugfix nL ns mosses with more than 5 periods having tamnams info |
||
| Line 186: | Line 186: | ||
-- a larger array. | -- a larger array. | ||
function p.tamnams_information(input_mos) | function p.tamnams_information(input_mos) | ||
local input_mos = input_mos or mos.new( | local input_mos = input_mos or mos.new(6,6,3) | ||
-- If a mos is octave-equivalent and has 10 or fewer steps, then it has a | -- If a mos is octave-equivalent and has 10 or fewer steps, then it has a | ||
-- tamnams name/prefix/abbrev. | -- tamnams name/prefix/abbrev. | ||
-- If a mos is octave-equivalent | -- If a mos is octave-equivalent, has more than 10 steps, and is not a root | ||
-- mos nL ns, then: | |||
-- - If it has 5 periods or less, then its closest ancestor has a tamnams | -- - If it has 5 periods or less, then its closest ancestor has a tamnams | ||
-- name. | -- name. | ||
-- - If it has more than 5 periods, then it relates to a root mos nL ns that | -- - If it has more than 5 periods, then it relates to a root mos nL ns that | ||
-- has more than 10 steps | -- has more than 10 steps (ancestor therefore has no tamnams name). | ||
-- If a mos is not octave-equivalent, then it may have a tamnams name (if | -- If a mos is not octave-equivalent, then it may have a tamnams name (if | ||
-- step count is 5 or less; currently unsupported) or not. | -- step count is 5 or less; currently unsupported) or not. | ||
| Line 200: | Line 201: | ||
local is_within_named_range = mos.equave_step_count(input_mos) <= 10 | local is_within_named_range = mos.equave_step_count(input_mos) <= 10 | ||
local is_within_period_count = mos.period_count(input_mos) <= 5 | local is_within_period_count = mos.period_count(input_mos) <= 5 | ||
local is_root_mos = input_mos.nL == input_mos.ns | |||
local section_header = "TAMNAMS information" | local section_header = "TAMNAMS information" | ||
| Line 210: | Line 212: | ||
{"[[TAMNAMS#Mos_pattern_names | Abbrev.]]", tamnams.lookup_abbrev(input_mos)} | {"[[TAMNAMS#Mos_pattern_names | Abbrev.]]", tamnams.lookup_abbrev(input_mos)} | ||
} | } | ||
elseif is_octave_equivalent and not is_within_named_range then | elseif is_octave_equivalent and not is_within_named_range and not is_root_mos then | ||
-- Lookup closest named ancestor mos | -- Lookup closest named ancestor mos | ||
local ancestor_mos, ratio_1, ratio_2, generations = tamnams.find_ancestor_info(input_mos) | local ancestor_mos, ratio_1, ratio_2, generations = tamnams.find_ancestor_info(input_mos) | ||