Module:TAMNAMS: Difference between revisions

Ganaram inukshuk (talk | contribs)
m Added todo
Ganaram inukshuk (talk | contribs)
Added capitalization option
Line 6: Line 6:
local utils = require('Module:Utils')
local utils = require('Module:Utils')
local p = {}
local p = {}
-- TODO
-- - Adjust prefix input to be the following: use the prefix provided, then look
--  up the prefix, then default to the general prefix of "mos".


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Line 382: Line 378:
function p.interval_quality(interval, input_mos, abbrev_format, mos_prefix)
function p.interval_quality(interval, input_mos, abbrev_format, mos_prefix)
local abbrev_format = abbrev_format or "none"
local abbrev_format = abbrev_format or "none"
local mos_prefix = p.lookup_prefix(input_mos) or mos_prefix or "mos"
local mos_prefix = mos_prefix or p.lookup_prefix(input_mos) or "mos"
-- Get the step count of the interval. The sum of L's and s's will always
-- Get the step count of the interval. The sum of L's and s's will always
Line 405: Line 401:
function p.degree_quality(interval, input_mos, abbrev_format, mos_prefix)
function p.degree_quality(interval, input_mos, abbrev_format, mos_prefix)
local abbrev_format = abbrev_format or "none"
local abbrev_format = abbrev_format or "none"
local mos_prefix = p.lookup_prefix(input_mos) or mos_prefix or "mos"
local mos_prefix = mos_prefix or p.lookup_prefix(input_mos) or "mos"
-- Get the step count of the interval. The sum of L's and s's will always
-- Get the step count of the interval. The sum of L's and s's will always
Line 500: Line 496:
else
else
quality = "perfect"
quality = "perfect"
end
if chroma_abs > 1 then
quality = string.format("%d× %s", chroma_abs, quality)
end
elseif abbrev_format == "sentence-case" or "SENTENCE-CASE" then
if chroma_count < 0 then
quality = "Diminished"
elseif chroma_count > 0 then
quality = "Augmented"
else
quality = "Perfect"
end
end
Line 546: Line 554:
else
else
quality = is_positive and "major" or "minor"
quality = is_positive and "major" or "minor"
end
if chroma_abs > 1 then
quality = string.format("%d× %s", chroma_abs, quality)
end
elseif abbrev_format == "sentence-case" or "SENTENCE-CASE" then
if chroma_abs > 0 and is_positive then
quality = "Augmented"
elseif chroma_abs > 0 and not is_positive then
quality = "Diminished"
else
quality = is_positive and "Major" or "Minor"
end
end