Module:MOS mode degrees: Difference between revisions
Todo; to distinguish this from mos modes and to follow with current usage of mos mode names, this template will no longer display mode names and mos modes will be used for displaying names |
ArrowHead294 (talk | contribs) mNo edit summary |
||
| (15 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
local p = {} | |||
local mos = require("Module:MOS") | local mos = require("Module:MOS") | ||
local tamnams = require("Module:TAMNAMS") | |||
local tip = require("Module:Template input parse") | local tip = require("Module:Template input parse") | ||
local yesno = require("Module:Yesno") | local yesno = require("Module:Yesno") | ||
-- TODO | -- TODO | ||
| Line 99: | Line 100: | ||
table.insert(udps, udps_closest_bright[i]) | table.insert(udps, udps_closest_bright[i]) | ||
else | else | ||
table.insert(udps, string.format("%s<br>%s", udps_closest_bright[i], udps_closest_dark[i])) | table.insert(udps, string.format("%s<br />%s", udps_closest_bright[i], udps_closest_dark[i])) | ||
end | end | ||
table.insert(cpos, i) | table.insert(cpos, i) | ||
| Line 111: | Line 112: | ||
-- Table's title | -- Table's title | ||
-- If it's for a modmos, add the step pattern | -- If it's for a modmos, add the step pattern | ||
result = result .. "|+ style=\"font-size: 105%; white-space: nowrap;\" | " .. string.format("Scale degrees of the modes of %s", scale_sig) | |||
result = result .. "|+ style=\"font-size: 105%; white-space: nowrap;\" | " .. string.format("%s\n", | .. (is_true_mos and "\n" or string.format(" (%s)\n", step_pattern)) | ||
.. "|-\n" | .. "|-\n" | ||
-- Add table headers for first row | -- Add table headers for first row | ||
result = result | result = result | ||
.. "! rowspan=\"2\" | UDP " .. (is_true_mos and "" or " and<br>alterations ") -- If modmos, add "and alterations" string | .. "! rowspan=\"2\" | UDP" .. (is_true_mos and "\n" or " and<br />alterations\n") -- If modmos, add "and alterations" string | ||
.. " | .. "! rowspan=\"2\" | Cyclic<br />order\n" | ||
.. " | .. "! rowspan=\"2\" | Step<br />pattern\n" | ||
-- Add header for scale degrees | -- Add header for scale degrees | ||
result = result .. string.format(" | result = result .. string.format("! colspan=\"%d\" class=\"unsortable\" | Scale degree (%sdegree)\n", #step_matrices[1], mos_prefix) | ||
-- Add second row of headers | -- Add second row of headers | ||
| Line 128: | Line 129: | ||
.. "! 0" | .. "! 0" | ||
for i = 1, #step_patterns[1] do | for i = 1, #step_patterns[1] do | ||
result = result .. string.format(" | result = result .. string.format("\n! %d", i) | ||
end | end | ||
| Line 138: | Line 139: | ||
-- Add brightness order (as UDP), rotational order, and step pattern | -- Add brightness order (as UDP), rotational order, and step pattern | ||
.. string.format("| %s | .. string.format("| %s\n| %s\n| %s\n", udps[i], cpos[i], step_patterns[i]) | ||
-- Add scale degrees with cell coloring | -- Add scale degrees with cell coloring | ||
| Line 146: | Line 147: | ||
local cell_color = p.cell_color(current_interval, input_mos) | local cell_color = p.cell_color(current_interval, input_mos) | ||
local style_code = cell_color == p.cell_color_none and "" or string.format("style=\"background: %s;\" | ", cell_color) | local style_code = (cell_color == p.cell_color_none and "" or string.format("style=\"background: %s;\" | ", cell_color)) | ||
result = result .. string.format(" | result = result .. string.format("| %s%s\n", style_code, degree_quality) | ||
end | end | ||
end | end | ||
| Line 166: | Line 166: | ||
local step_pattern = frame.args["MODMOS Step Pattern"] | local step_pattern = frame.args["MODMOS Step Pattern"] | ||
local mode_names_unparsed = frame.args["Mode Names"] | local mode_names_unparsed = frame.args["Mode Names"] | ||
-- Parse debugging option | |||
local debugg = yesno(frame.args["debug"]) | |||
-- Get the scale sig; for calculating the mos prefix | -- Get the scale sig; for calculating the mos prefix | ||
| Line 186: | Line 189: | ||
-- Closest-mode search always returns one name | -- Closest-mode search always returns one name | ||
mode_names = { | mode_names = { | ||
"Harmonic minor<br>(Aeolian ♮7)", | "Harmonic minor<br />(Aeolian ♮7)", | ||
"Locrian ♮6", | "Locrian ♮6", | ||
"Ionian augmented<br>(Ionian ♯5)", | "Ionian augmented<br />(Ionian ♯5)", | ||
"Dorian ♯4", | "Dorian ♯4", | ||
"Phrygian dominant<br>(Phrygian ♮3)", | "Phrygian dominant<br />(Phrygian ♮3)", | ||
"Lydian ♯2", | "Lydian ♯2", | ||
"Altered diminished<br>(Locrian ♭4 𝄫7)", | "Altered diminished<br />(Locrian ♭4 𝄫7)", | ||
} | } | ||
elseif step_pattern == "LLsLsAs" then | elseif step_pattern == "LLsLsAs" then | ||
| Line 198: | Line 201: | ||
-- Closest-mode search always returns one name | -- Closest-mode search always returns one name | ||
mode_names = { | mode_names = { | ||
"Harmonic major<br>(Ionian ♭6)", | "Harmonic major<br />(Ionian ♭6)", | ||
"Dorian ♭5", | "Dorian ♭5", | ||
"Phrygian ♭4", | "Phrygian ♭4", | ||
"Lydian ♭3", | "Lydian ♭3", | ||
"Mixolydian ♭2", | "Mixolydian ♭2", | ||
"Lydian augmented ♯2<br>(Lydian ♯2 ♯5)", | "Lydian augmented ♯2<br />(Lydian ♯2 ♯5)", | ||
"Locrian 𝄫7", | "Locrian 𝄫7", | ||
} | } | ||
| Line 210: | Line 213: | ||
-- Closest-mode search sometimes returns two names | -- Closest-mode search sometimes returns two names | ||
mode_names = { | mode_names = { | ||
"Melodic minor<br>(Ionian ♭3, Dorian ♮7)", | "Melodic minor<br />(Ionian ♭3, Dorian ♮7)", | ||
"Dorian ♭2, Phrygian ♮6", | "Dorian ♭2, Phrygian ♮6", | ||
"Lydian augmented<br>(Lydian ♯5)", | "Lydian augmented<br />(Lydian ♯5)", | ||
"Lydian dominant<br>(Lydian ♭7, Mixolydian ♯4)", | "Lydian dominant<br />(Lydian ♭7, Mixolydian ♯4)", | ||
"Mixolydian ♭6, Aeolian ♮3", | "Mixolydian ♭6, Aeolian ♮3", | ||
"Half-diminished<br>(Aeolian ♭5, Locrian ♮2)", | "Half-diminished<br />(Aeolian ♭5, Locrian ♮2)", | ||
"Altered, Altered dominant<br>(Locrian ♭4)", | "Altered, Altered dominant<br />(Locrian ♭4)", | ||
} | } | ||
elseif step_pattern == "sLLLLLs" then | elseif step_pattern == "sLLLLLs" then | ||
| Line 222: | Line 225: | ||
-- Closest-mode search sometimes returns two names | -- Closest-mode search sometimes returns two names | ||
mode_names = { | mode_names = { | ||
"Neapolitan major<br>(Ionian ♭2 ♭3, Phrigian ♮6 ♮7)", | "Neapolitan major<br />(Ionian ♭2 ♭3, Phrigian ♮6 ♮7)", | ||
"Lydian augmented ♯6<br>(Lydian ♯5 ♯6)", | "Lydian augmented ♯6<br />(Lydian ♯5 ♯6)", | ||
"Lydian augmented dominant<br>(Lydian ♯5 ♭7, Mixolydian ♯4 ♯5)", | "Lydian augmented dominant<br />(Lydian ♯5 ♭7, Mixolydian ♯4 ♯5)", | ||
"Lydian minor<br>(Lydian ♭6 ♭7, Aeolian ♮3 ♯4)", | "Lydian minor<br />(Lydian ♭6 ♭7, Aeolian ♮3 ♯4)", | ||
"Major locrian<br>(Mixolydian ♭5 ♭6, Locrian ♮2 ♮3)", | "Major locrian<br />(Mixolydian ♭5 ♭6, Locrian ♮2 ♮3)", | ||
"Altered dominant ♮2<br>(Aeolian ♭4 ♭5, Locrian ♮2, ♭4)", | "Altered dominant ♮2<br />(Aeolian ♭4 ♭5, Locrian ♮2, ♭4)", | ||
"Altered dominant 𝄫3<br>(Locrian 𝄫3 ♭4)", | "Altered dominant 𝄫3<br />(Locrian 𝄫3 ♭4)", | ||
} | } | ||
elseif step_pattern == "sLLLsAs" then | elseif step_pattern == "sLLLsAs" then | ||
| Line 234: | Line 237: | ||
-- Closest-mode search always returns one name | -- Closest-mode search always returns one name | ||
mode_names = { | mode_names = { | ||
"Neapolitan minor<br>(Phrygian ♮7)", | "Neapolitan minor<br />(Phrygian ♮7)", | ||
"Lydian ♯6", | "Lydian ♯6", | ||
"Mixolydian augmented<br>(Mixolydian ♯5)", | "Mixolydian augmented<br />(Mixolydian ♯5)", | ||
"Aeolian ♯4", | "Aeolian ♯4", | ||
"Locrian dominant<br>(Locrian ♮3)", | "Locrian dominant<br />(Locrian ♮3)", | ||
"Ionian ♯2", | "Ionian ♯2", | ||
"Altered diminished 𝄫3<br>(Locrian 𝄫3 ♭4 𝄫7)", | "Altered diminished 𝄫3<br />(Locrian 𝄫3 ♭4 𝄫7)", | ||
} | } | ||
elseif step_pattern == "sAsLsAs" then | elseif step_pattern == "sAsLsAs" then | ||
| Line 246: | Line 249: | ||
-- Closest-mode search sometimes returns two names | -- Closest-mode search sometimes returns two names | ||
mode_names = { | mode_names = { | ||
"Double harmonic<br>(Ionian ♭2 ♭6, Phrygian ♮3 ♮7)", | "Double harmonic<br />(Ionian ♭2 ♭6, Phrygian ♮3 ♮7)", | ||
"Lydian ♯2 ♯6", | "Lydian ♯2 ♯6", | ||
"Altered ♮5 𝄫6<br>(Phrygian ♭4 𝄫7)", | "Altered ♮5 𝄫6<br />(Phrygian ♭4 𝄫7)", | ||
"Double harmonic minor<br>(Lydian ♭3 ♭6, Aeolian ♯4 ♮7)", | "Double harmonic minor<br />(Lydian ♭3 ♭6, Aeolian ♯4 ♮7)", | ||
"Mixolydian ♭2 ♭5, Locrian ♮3 ♮6", | "Mixolydian ♭2 ♭5, Locrian ♮3 ♮6", | ||
"Ionian augmented ♯2<br>(Ionian ♯2 ♯5)", | "Ionian augmented ♯2<br />(Ionian ♯2 ♯5)", | ||
"Locrian 𝄫3 𝄫7", | "Locrian 𝄫3 𝄫7", | ||
} | } | ||
| Line 292: | Line 295: | ||
end | end | ||
return result | -- Debugger option | ||
if debugg == true then | |||
result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" | |||
end | |||
return frame:preprocess(result) | |||
end | end | ||
return p | return p | ||