Module:MOS genchain: Difference between revisions
adjusted genchain length |
Added textual description |
||
| Line 114: | Line 114: | ||
-- .. result | -- .. result | ||
return result | |||
end | |||
function p.mos_genchain_description(input_mos) | |||
local input_mos = input_mos or mos.new(6,2) | |||
-- How many periods? | |||
local period_count = mos.period_count(input_mos) | |||
local period_interval = mos.period(input_mos) | |||
-- What are the period intervals? | |||
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.degree_quality(period_intervals[1], input_mos), tamnams.degree_quality(period_intervals[2], input_mos)) | |||
else | |||
for i = 1, period_count do | |||
period_intervals_as_text = period_intervals_as_text | |||
.. string.format("%s, ", tamnams.degree_quality(period_intervals[i], input_mos)) | |||
end | |||
period_intervals_as_text = period_intervals_as_text | |||
.. string.format("and %s", tamnams.degree_quality(period_intervals[period_count + 1], input_mos)) | |||
end | |||
-- What is the bright gen and at what scale degrees do you stack from? | |||
local bright_gen_as_text = tamnams.interval_quality(mos.bright_gen(input_mos), input_mos) | |||
local result = string.format("A chain of bright generators, each a %s, produces the following scale degrees.", bright_gen_as_text) | |||
-- How long is the chain? | |||
local period_step_count = mos.period_step_count(input_mos) | |||
local scalesig = mos.as_string(input_mos) | |||
result = result | |||
.. " " | |||
.. string.format("A chain of %s consecutive scale degrees %sproduces one of the modes of %s.", period_step_count, (period_count == 1 and "" or "for each period "), scalesig) | |||
-- What scales are produced when the chain is extended further? | |||
local child_scale_chain_length = input_mos.nL + input_mos.nL + input_mos.ns | |||
local child_scale_1 = mos.new(input_mos.nL+input_mos.ns, input_mos.nL, input_mos.equave) | |||
local child_scale_2 = mos.new(input_mos.nL, input_mos.nL+input_mos.ns, input_mos.equave) | |||
result = result | |||
.. " " | |||
.. string.format("Expanding %s chain to %s scale degrees produces the modes of either %s or %s.", | |||
(period_count == 1 and "the" or "each"), | |||
child_scale_chain_length / period_count, | |||
mos.as_string(child_scale_1), | |||
mos.as_string(child_scale_2) | |||
) | |||
return result | return result | ||
end | end | ||
| Line 121: | Line 175: | ||
local input_mos = mos.parse(scalesig) or mos.new(5,2) | local input_mos = mos.parse(scalesig) or mos.new(5,2) | ||
return p._mos_genchain(input_mos) | return p.mos_genchain_description(input_mos) .. "\n" .. p._mos_genchain(input_mos) | ||
end | end | ||
return p | return p | ||