Module:MOS gamut: Difference between revisions
No edit summary |
Switched formatting to be text-based, as that's the de-facto standard |
||
| Line 342: | Line 342: | ||
local gamut = p.mos_gamut(input_mos, generators_up, step_ratio, note_symbols, chroma_plus_symbol, chroma_minus_symbol) | local gamut = p.mos_gamut(input_mos, generators_up, step_ratio, note_symbols, chroma_plus_symbol, chroma_minus_symbol) | ||
-- Old code for a horizontal table; the default is now a vertical table | |||
--[[ | |||
-- Format the gamut as a table | -- Format the gamut as a table | ||
local result = '{| class="wikitable"\n' | local result = '{| class="wikitable"\n' | ||
-- Create the first row; this needs an edo for the header, followed by the | -- Create the first row; this needs an edo for the header, followed by the | ||
-- steps | -- steps | ||
| Line 375: | Line 375: | ||
end | end | ||
end | end | ||
result = result .. "|}" | |||
]]-- | ]]-- | ||
--[[ | |||
-- Format the gamut as a table | |||
local result = '{| class="wikitable"\n' | |||
-- Produce the headers | -- Produce the headers | ||
| Line 403: | Line 409: | ||
result = result .. "|}" | result = result .. "|}" | ||
]]-- | |||
-- Since the gamut on a mos page is just text, so will this | |||
-- Formatting options may be explored at a later date | |||
local steps_in_et = input_mos.nL * step_ratio[1] + input_mos.ns * step_ratio[2] | |||
local et_for_mos = et.new(steps_in_et, input_mos.equave) | |||
local result = "Gamut for " .. et.as_string(et_for_mos) .. ": " | |||
for i = 1, #gamut - 1 do | |||
-- If the note name does not contain accidentals, it's a natural and should be bold | |||
local note_name = gamut[i] | |||
if string.match(note_name, chroma_plus_symbol) or string.match(note_name, chroma_minus_symbol) then | |||
result = result .. note_name .. ", " | |||
else | |||
result = result .. "'''" .. note_name .. "''', " | |||
end | |||
end | |||
result = result .. "'''" .. gamut[#gamut] .. "'''" | |||
return result | return result | ||