「モジュール:MOS」の版間の差分
編集の要約なし |
編集の要約なし |
||
| 733行目: | 733行目: | ||
------------------------ 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行目: | 747行目: | ||
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 step ratio, compute the number of et-steps for its bright gen | |||
-- as a string "{steps}\{division}{suffix}". | |||
function p.bright_gen_to_et_string(mos, step_ratio, suffix) | |||
return p.interval_to_et_string(p.bright_gen(mos), mos, step_ratio, suffix) | |||
end | |||
-- Given a mos and | -- Given a mos and step ratio, compute the number of et-steps for its dark gen, | ||
-- | -- as a string "{steps}\{division}{suffix}". | ||
function p. | function p.dark_gen_to_et_string(mos, step_ratio, suffix) | ||
return p. | 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 | ||