Module:MOS intervals: Difference between revisions

Ganaram inukshuk (talk | contribs)
mNo edit summary
Ganaram inukshuk (talk | contribs)
Interval table now shows mos intervals in increasing size, from the unison to the octave/equave
Line 102: Line 102:
-- Create the table, starting with the headers
-- Create the table, starting with the headers
local result = '{| class="wikitable"\n'
local result = '{| class="wikitable"\n'
result = result .. '|+\n'
result = result .. '|+Intevrals of ' .. scale_sig .. '\n'
result = result .. scale_sig .. ' interval varieties\n'
result = result .. '! Interval classes\n'
result = result .. '! rowspan="2" |Interval class\n'
result = result .. '! Specific intervals\n'
result = result .. '! colspan="2" |Large variety\n'
result = result .. '! Size (in ascending order)\n'
result = result .. '! colspan="2" |Small variety\n'
result = result .. '|-\n'
result = result .. '! Size\n'
result = result .. '! Quality\n'
result = result .. '!Size\n'
result = result .. '!Quality\n'
-- First row is the unison
-- First row is the unison
result = result .. "|-\n"
result = result .. "|-\n"
result = result .. "|'''0-" .. mos_prefix .. "step (unison)'''\n"
result = result .. "|'''0-" .. mos_prefix .. "step'''\n"
result = result .. "|'''Perfect 0-" .. mos_prefix .. "step'''\n"
result = result .. "|0\n"
result = result .. "|0\n"
result = result .. "|Perfect\n"
result = result .. "|0\n"
result = result .. "|Perfect\n"
-- Successive rows are the mossteps, starting at the 1-mosstep
-- Successive rows are the mossteps, starting at the 1-mosstep
Line 127: Line 119:
local is_nL_ns = input_mos.nL == input_mos.ns
local is_nL_ns = input_mos.nL == input_mos.ns
for i = 1, steps_per_equave - 1 do
for i = 1, steps_per_equave - 1 do
-- If i corresponds to the bright generator, then the large size is
-- perfect and the small size is diminished.
-- If i corresponds to the dark generator, then the large size is
-- augmented and the small size is perfect.
-- If i corresponds to the period, then the large and small sizes are
-- the same and they're perfect. This also applies to the equave.
-- For any other interval, and for generators for nL ns mosses, the
-- large size is major and the small size is minor.
result = result .. "|-\n"
if i % steps_per_period == steps_per_bright_gen and not is_nL_ns then
if i % steps_per_period == steps_per_bright_gen and not is_nL_ns then
result = result .. "|'''" .. i .. "-" .. mos_prefix .. "step'''\n"
-- If i corresponds to the bright generator, then the large size is
-- perfect and the small size is diminished. Add two rows.
result = result .. "|-\n"
result = result .. '|rowspan="2"' .. "|'''" .. i .. "-" .. mos_prefix .. "step'''\n"
result = result .. "|Diminished" .. i .. "-" .. mos_prefix .. "step'''\n"
result = result .. "|" .. p.mos_interval_to_step_count_string(darkest_mode, i) .. "\n"
result = result .. "|-\n"
result = result .. "|Perfect" .. i .. "-" .. mos_prefix .. "step'''\n"
result = result .. "|" .. p.mos_interval_to_step_count_string(brightest_mode, i) .. "\n"
result = result .. "|" .. p.mos_interval_to_step_count_string(brightest_mode, i) .. "\n"
result = result .. "|Perfect\n"
result = result .. "|" .. p.mos_interval_to_step_count_string(darkest_mode, i) .. "\n"
result = result .. "|Diminished\n"
elseif i % steps_per_period == steps_per_dark_gen and not is_nL_ns then
elseif i % steps_per_period == steps_per_dark_gen and not is_nL_ns then
result = result .. "|'''" .. i .. "-" .. mos_prefix .. "step'''\n"
-- If i corresponds to the dark generator, then the large size is
-- augmented and the small size is perfect. Add two rows.
result = result .. "|-\n"
result = result .. '|rowspan="2"' .. "|'''" .. i .. "-" .. mos_prefix .. "step'''\n"
result = result .. "|Perfect" .. i .. "-" .. mos_prefix .. "step'''\n"
result = result .. "|" .. p.mos_interval_to_step_count_string(darkest_mode, i) .. "\n"
result = result .. "|-\n"
result = result .. "|Augmented" .. i .. "-" .. mos_prefix .. "step'''\n"
result = result .. "|" .. p.mos_interval_to_step_count_string(brightest_mode, i) .. "\n"
result = result .. "|" .. p.mos_interval_to_step_count_string(brightest_mode, i) .. "\n"
result = result .. "|Augmented\n"
result = result .. "|" .. p.mos_interval_to_step_count_string(darkest_mode, i) .. "\n"
result = result .. "|Perfect\n"
elseif i % steps_per_period == 0 and i ~= mossteps_per_equave then
elseif i % steps_per_period == 0 and i ~= mossteps_per_equave then
-- If i corresponds to the period, then the large and small sizes are
-- the same and they're perfect. This also applies to the equave. Add one row.
result = result .. "|-\n"
result = result .. "|'''" .. i .. "-" .. mos_prefix .. "step (period)'''\n"
result = result .. "|'''" .. i .. "-" .. mos_prefix .. "step (period)'''\n"
result = result .. "|" .. p.mos_interval_to_step_count_string(brightest_mode, i) .. "\n"
result = result .. "|Perfect" .. i .. "-" .. mos_prefix .. "step'''\n"
result = result .. "|Perfect\n"
result = result .. "|" .. p.mos_interval_to_step_count_string(darkest_mode, i) .. "\n"
result = result .. "|" .. p.mos_interval_to_step_count_string(darkest_mode, i) .. "\n"
result = result .. "|Perfect\n"
else
else
result = result .. "|" .. i .. "-" .. mos_prefix .. "step\n"
-- For any other interval, and for generators for nL ns mosses, the
-- large size is major and the small size is minor. Add two rows.
result = result .. "|-\n"
result = result .. '|rowspan="2"' .. "|'''" .. i .. "-" .. mos_prefix .. "step'''\n"
result = result .. "|Minor" .. i .. "-" .. mos_prefix .. "step'''\n"
result = result .. "|" .. p.mos_interval_to_step_count_string(darkest_mode, i) .. "\n"
result = result .. "|-\n"
result = result .. "|Major" .. i .. "-" .. mos_prefix .. "step'''\n"
result = result .. "|" .. p.mos_interval_to_step_count_string(brightest_mode, i) .. "\n"
result = result .. "|" .. p.mos_interval_to_step_count_string(brightest_mode, i) .. "\n"
result = result .. "|Major\n"
result = result .. "|" .. p.mos_interval_to_step_count_string(darkest_mode, i) .. "\n"
result = result .. "|Minor\n"
end
end
end
end
-- Manually add the last row of the table (this is for the equave)
-- Add the last row of the table, either the equave or octave
result = result .. "|-\n"
result = result .. "|'''" .. steps_per_equave .. "-" .. mos_prefix .. "step"
-- Is the equave 2/1?
-- Is the equave 2/1?
local equave_name = ""
if rat.eq(input_mos.equave, 2) then
if rat.eq(input_mos.equave, 2) then
result = result .. " (octave)'''\n"
result = result .. "|-\n"
result = result .. "|'''" .. steps_per_equave .. "-" .. mos_prefix .. "step (octave)'''\n"
result = result .. "|Perfect" .. steps_per_equave .. "-" .. mos_prefix .. "step'''\n"
result = result .. "|" .. p.mos_interval_to_step_count_string(darkest_mode, i) .. "\n"
else
else
result = result .. " (equave)'''\n"
result = result .. "|-\n"
result = result .. "|'''" .. steps_per_equave .. "-" .. mos_prefix .. "step (equave)'''\n"
result = result .. "|Perfect" .. steps_per_equave .. "-" .. mos_prefix .. "step'''\n"
result = result .. "|" .. p.mos_interval_to_step_count_string(darkest_mode, i) .. "\n"
end
end
-- Add the last cells
result = result .. "|" .. p.mos_interval_to_step_count_string(brightest_mode, steps_per_equave) .. "\n"
result = result .. "|Perfect\n"
result = result .. "|" .. p.mos_interval_to_step_count_string(darkest_mode, steps_per_equave) .. "\n"
result = result .. "|Perfect\n"
result = result .. "|}"
result = result .. "|}"
 
return result
return result
end
end


return p
return p