Module:MOS intervals: Difference between revisions

Ganaram inukshuk (talk | contribs)
m Remove unused module; a linebreak
Ganaram inukshuk (talk | contribs)
Removed mos interval description (to be used elsewhere)
Line 96: Line 96:
result = result .. "|}"
result = result .. "|}"


return result
end
function p.mos_intervals_description(input_mos, mos_prefix)
local input_mos = input_mos or mos.new(5,2)
local mos_prefix = mos_prefix or "dia"
local scalesig = mos.as_string(input_mos)
-- How many periods?
-- What are the period intervals?
local period_count = mos.period_count(input_mos)
local period_interval = mos.period(input_mos)
local period_intervals = {}
for i = 1, period_count + 1 do
local interval = mos.interval_mul(period_interval, i-1)
table.insert(period_intervals, interval)
end
-- As a sentence piece
local period_intervals_as_text = ""
if #period_intervals == 2 then
period_intervals_as_text = string.format("%s and %s", tamnams.interval_quality(period_intervals[1], input_mos, "none", mos_prefix), tamnams.interval_quality(period_intervals[2], input_mos, "none", mos_prefix))
else
for i = 1, period_count do
period_intervals_as_text = period_intervals_as_text
.. string.format("%s, ", tamnams.interval_quality(period_intervals[i], input_mos, "none", mos_prefix))
end
period_intervals_as_text = period_intervals_as_text
.. string.format("and %s", tamnams.interval_quality(period_intervals[period_count + 1], input_mos, "none", mos_prefix))
end
local result = string.format("The intervals of %s are named after the number of mossteps (L and s) they subtend.", scalesig)
local period_interval_desc = ""
if period_count == 1 then
period_interval_desc = "the root and " .. (rat.eq(input_mos.equave, 2) and "octave" or "equave")
else
period_interval_desc = "the period intervals"
end
result = result
.. string.format(" Each interval, apart from %s (%s), has two varieties, or sizes, each.", period_interval_desc, period_intervals_as_text)
result = result
.. " Interval varieties are named major and minor for the large and small sizes, respectively"
.. (input_mos.nL == input_mos.ns and "." or ", and augmented, perfect, and diminished for the scale's generators.")
return result
return result
end
end