「モジュール:TAMNAMS」の版間の差分
編集の要約なし タグ: 手動差し戻し |
編集の要約なし |
||
| (同じ利用者による、間の5版が非表示) | |||
| 85行目: | 85行目: | ||
-- Lookup table for tamnams names within the range of 6-10 steps | -- Lookup table for tamnams names within the range of 6-10 steps | ||
p.mos_names = { | p.mos_names = { | ||
["1L 1s"] = " | ["1L 1s"] = "Monowood", | ||
["2L 2s"] = " | ["2L 2s"] = "Biwood", | ||
["1L 5s"] = " | ["1L 5s"] = "Antimachinoid", | ||
["2L 4s"] = " | ["2L 4s"] = "Malic", | ||
["3L 3s"] = " | ["3L 3s"] = "Triwood", | ||
["4L 2s"] = " | ["4L 2s"] = "Citric", | ||
["5L 1s"] = " | ["5L 1s"] = "Machinoid", | ||
["1L 6s"] = " | ["1L 6s"] = "Onyx", | ||
["2L 5s"] = " | ["2L 5s"] = "Antidiatonic", | ||
["3L 4s"] = " | ["3L 4s"] = "Mosh", | ||
["4L 3s"] = " | ["4L 3s"] = "Smitonic", | ||
["5L 2s"] = " | ["5L 2s"] = "Diatonic", | ||
["6L 1s"] = " | ["6L 1s"] = "Archaeotonic", | ||
["1L 7s"] = " | ["1L 7s"] = "Antipine", | ||
["2L 6s"] = " | ["2L 6s"] = "Subaric", | ||
["3L 5s"] = " | ["3L 5s"] = "Checkertonic", | ||
["4L 4s"] = " | ["4L 4s"] = "Tetrawood", | ||
["5L 3s"] = " | ["5L 3s"] = "Oneirotonic", | ||
["6L 2s"] = " | ["6L 2s"] = "Ekic", | ||
["7L 1s"] = " | ["7L 1s"] = "Pine", | ||
["1L 8s"] = " | ["1L 8s"] = "Antisubneutralic", | ||
["2L 7s"] = " | ["2L 7s"] = "Balzano", | ||
["3L 6s"] = " | ["3L 6s"] = "Tcherepnin", | ||
["4L 5s"] = " | ["4L 5s"] = "Gramitonic", | ||
["5L 4s"] = " | ["5L 4s"] = "Semiquartal", | ||
["6L 3s"] = " | ["6L 3s"] = "Hyrulic", | ||
["7L 2s"] = " | ["7L 2s"] = "Armotonic", | ||
["8L 1s"] = " | ["8L 1s"] = "Subneutralic", | ||
["1L 9s"] = " | ["1L 9s"] = "Antisinatonic", | ||
["2L 8s"] = " | ["2L 8s"] = "Jaric", | ||
["3L 7s"] = " | ["3L 7s"] = "Sephiroid", | ||
["4L 6s"] = " | ["4L 6s"] = "Lime", | ||
["5L 5s"] = " | ["5L 5s"] = "Pentawood", | ||
["6L 4s"] = " | ["6L 4s"] = "Lemon", | ||
["7L 3s"] = " | ["7L 3s"] = "Dicoid", | ||
["8L 2s"] = " | ["8L 2s"] = "Taric", | ||
["9L 1s"] = " | ["9L 1s"] = "Sinatonic" | ||
} | } | ||
| 988行目: | 988行目: | ||
return differences | return differences | ||
end | end | ||
-- 日本語対応用 | |||
function p.interval_quality_japanese(interval, input_mos) | |||
-- Get the step count of the interval. The sum of L's and s's will always | |||
-- determine what k-mosstep the interval is. | |||
local step_count = mos.interval_step_count(interval) | |||
-- Decode the quality | |||
local quality = p.decode_quality_japanese(interval, input_mos, abbrev_format) | |||
return string.format("%s%d度", quality, step_count) | |||
end | |||
function p.degree_quality_japanese(interval, input_mos) | |||
-- Get the step count of the interval. The sum of L's and s's will always | |||
-- determine what k-mosstep the interval is. | |||
local step_count = mos.interval_step_count(interval) | |||
-- Decode the quality | |||
local quality = p.decode_quality_japanese(interval, input_mos) | |||
return string.format("%s%d度", quality, step_count) | |||
end | |||
function p.decode_quality_japanese(interval, input_mos) | |||
-- Normalize the interval so negative values aren't being used. | |||
local interval = mos.normalize_interval(interval) | |||
-- Get the step count of the interval. The sum of L's and s's will always | |||
-- determine what k-mosstep the interval is. | |||
local step_count = mos.interval_step_count(interval) | |||
-- Determine what "special" type the interval is so that the designations | |||
-- of augmented/perfect/diminished (APd) apply, skipping major/minor (Mm). | |||
-- If it's the period or equave, then it's a multiple of the period. | |||
-- If it's any one of the gens, then reducing it should produce that gen. | |||
local is_period = step_count % mos.period_step_count(input_mos) == 0 | |||
local is_bright_gen = step_count % mos.period_step_count(input_mos) == mos.bright_gen_step_count(input_mos) | |||
local is_dark_gen = step_count % mos.period_step_count(input_mos) == mos.dark_gen_step_count(input_mos) | |||
-- Special case: APd does not apply to a root mos's (nL ns) generators; | |||
-- instead, it's Mm. | |||
local is_root_mos = input_mos.nL == input_mos.ns | |||
-- Is perfectable? This is for intervals for which maj/min does not apply. | |||
local is_perfectable = is_period or (is_bright_gen and not is_root_mos) or (is_dark_gen and not is_root_mos) | |||
-- Get chroma count and adjust as needed | |||
local chroma_count = 0 | |||
if is_period then | |||
-- Chroma count 0 is the perfect size. This interval does not appear | |||
-- as any other size across all mos modes. | |||
chroma_count = mos.interval_chroma_count(interval, input_mos) | |||
elseif is_bright_gen and not is_root_mos then | |||
-- Chroma count 0 is the large size, and -1 the small size; these | |||
-- are perfect and diminished respectively. | |||
chroma_count = mos.interval_chroma_count(interval, input_mos) | |||
elseif is_dark_gen and not is_root_mos then | |||
-- Chroma count 0 is the large size, and -1 the small size; these | |||
-- are augmented and perfect respectively. Since the perfect size | |||
-- corresponds to a chroma count of -1, pass in -1 as the 3rd arg. | |||
chroma_count = mos.interval_chroma_count(interval, input_mos, -1) | |||
else | |||
-- Chroma count 0 is the large size, and -1 the small size; these are | |||
-- major and minor respectively. | |||
chroma_count = mos.interval_chroma_count(interval, input_mos) | |||
end | |||
-- Get absolute value of chroma count | |||
local chroma_abs = math.abs(chroma_count) | |||
local quality = "" | |||
if is_perfectable then | |||
-- Get the quality for perfectable intervals | |||
if chroma_count < 0 then | |||
quality = "減" | |||
elseif chroma_count > 0 then | |||
quality = "増" | |||
else | |||
quality = "完全" | |||
end | |||
else | |||
-- Get the quality for nonperfectable intervals | |||
-- Is the interval major? If not, decrement chroma_abs by 1 | |||
local is_positive = chroma_count >= 0 | |||
chroma_abs = is_positive and chroma_abs or chroma_abs - 1 | |||
if chroma_abs > 0 and is_positive then | |||
quality = "増" | |||
elseif chroma_abs > 0 and not is_positive then | |||
quality = "減" | |||
else | |||
quality = is_positive and "長" or "短" | |||
end | |||
if chroma_abs > 1 then | |||
quality = string.format("%d× %s", chroma_abs, quality) | |||
end | |||
end | |||
return quality | |||
end | |||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||