Module:MOS gamut: Difference between revisions
mNo edit summary |
Switched table to display note names vertically, horizontal code commented out |
||
| Line 345: | Line 345: | ||
local result = '{| class="wikitable"\n' | local result = '{| class="wikitable"\n' | ||
-- Old code for a horizontal table; the default is now a vertical table | |||
--[[ | |||
-- 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 373: | Line 375: | ||
end | end | ||
end | end | ||
]]-- | |||
-- Produce the headers | |||
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) | |||
result = result .. "! Steps of " .. et.as_string(et_for_mos) .. " !! Note name\n" | |||
-- Add the rows | |||
local step_ratio_gcd = rat.gcd(step_ratio[1], step_ratio[2]) -- GCD of the sizes of L and s, in case L:s isn't simplified | |||
result = result .. "|-" | |||
-- If note name string is one character, it's a natural so the row is white | |||
-- For anything else, the row is black (actually gray) to mimic a piano | |||
for i = 1, #gamut do | |||
if string.len(note_name) == 1 then | |||
result = result .. '|' .. step_ratio_gcd * (i-1) .. "||" .. note_name .. " \n\n" | |||
else | |||
result = result .. '|bgcolor="gray"|' .. step_ratio_gcd * (i-1) .. "||" .. note_name .. " \n\n" | |||
end | |||
end | |||
result = result .. "|}" | result = result .. "|}" | ||