「モジュール:MOS」の版間の差分
編集の要約なし |
編集の要約なし |
||
| (同じ利用者による、間の1版が非表示) | |||
| 270行目: | 270行目: | ||
end | end | ||
return matrices | return matrices | ||
end | |||
-- Given an input mos, produce its modal union. | |||
-- This is a listing of every interval's large and small sizes. | |||
function p.modal_union(input_mos) | |||
local brightest_mode = p.brightest_mode(input_mos) | |||
local darkest_mode = p.darkest_mode (input_mos) | |||
local interval_count = p.equave_step_count(input_mos) + 1 | |||
local modal_union = {} | |||
for i = 1, interval_count do | |||
local bright_step_seq = string.sub(brightest_mode, 1, i-1) | |||
local dark_step_seq = string.sub(darkest_mode , 1, i-1) | |||
local bright_interval = p.interval_from_step_sequence(bright_step_seq) | |||
local dark_interval = p.interval_from_step_sequence(dark_step_seq ) | |||
if p.interval_eq(bright_interval, dark_interval) then | |||
table.insert(modal_union, bright_interval) | |||
else | |||
table.insert(modal_union, dark_interval ) | |||
table.insert(modal_union, bright_interval) | |||
end | |||
end | |||
return modal_union | |||
end | end | ||
| 733行目: | 759行目: | ||
------------------------ EQUAL-TUNING STRING FUNCTIONS ------------------------- | ------------------------ EQUAL-TUNING STRING FUNCTIONS ------------------------- | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
-- Given a mos, return its equal temperament suffix as a string (edo, edt, edf, or ed-p/q). | -- Given a mos, return its equal temperament suffix as a string (edo, edt, edf, or ed-p/q). | ||
| 754行目: | 773行目: | ||
end | end | ||
-- Given a mos and step ratio, return its equal temperament as a string "{steps}\{division}{suffix}". | |||
function p.et_string(mos, step_ratio, suffix) | |||
local suffix = suffix or nil | |||
local et_mos = p.as_et(mos, step_ratio, suffix) | |||
return et.as_string(et_mos) | |||
end | |||
-- Given a mos and | -- Given a mos and step ratio, compute the number of et-steps for its bright gen | ||
-- | -- as a string "{steps}\{division}{suffix}". | ||
function p. | function p.bright_gen_to_et_string(mos, step_ratio, suffix) | ||
return p. | return p.interval_to_et_string(p.bright_gen(mos), mos, step_ratio, suffix) | ||
end | |||
-- Given a mos and step ratio, compute the number of et-steps for its dark gen, | |||
-- as a string "{steps}\{division}{suffix}". | |||
function p.dark_gen_to_et_string(mos, step_ratio, suffix) | |||
return p.interval_to_et_string(p.dark_gen(mos), mos, step_ratio, suffix) | |||
end | end | ||
-- Given a mos and | -- Given a mos and step ratio, compute the number of et-steps for its period, | ||
function p. | -- as a string "{steps}\{division}{suffix}". | ||
return p. | function p.period_to_et_string(mos, step_ratio, suffix) | ||
return p.interval_to_et_string(p.period(mos), mos, step_ratio, suffix) | |||
end | end | ||
-- Given a mos | -- Given a mos, compute the number of et-steps for its period, reduced, | ||
function p. | -- as a string "{steps}\{division}{suffix}". Does not reuqire a step ratio. | ||
return p. | -- NOTE: no such function for returning only the number of steps is needed since | ||
-- that's the same as period_count(). | |||
function p.reduced_period_to_et_string(mos, suffix) | |||
return p.interval_to_et_string({["L"] = 1, ["s"] = 1}, p.root(mos), {1,0}, suffix) | |||
end | end | ||
-- Given a mos and | -- Given a mos and step ratio, compute the number of et-steps for its equave, | ||
function p. | -- as a string "{steps}\{division}{suffix}". | ||
return p. | function p.equave_to_et_string(mos, step_ratio, suffix) | ||
return p.interval_to_et_string(p.equave(mos), mos, step_ratio, suffix) | |||
end | end | ||
-- Given an interval vector and step ratio, compute the number of et-steps it corresponds to. | -- Given an interval vector and step ratio, compute the number of et-steps it | ||
function p. | -- corresponds to, as a string "{steps}\{division}{suffix}". Requires info | ||
return interval | -- about the mos itself. | ||
function p.interval_to_et_string(interval, mos, step_ratio, suffix) | |||
local suffix = suffix or nil | |||
local mos_et = p.as_et(mos, step_ratio, suffix) | |||
return et.backslash_display(mos_et, p.interval_to_et_steps(interval, step_ratio)) | |||
end | end | ||