Module:MOS gamut: Difference between revisions

Ganaram inukshuk (talk | contribs)
Undo revision 118031 by Ganaram inukshuk (talk; parse function was put in the wrong place)
Tag: Undo
Ganaram inukshuk (talk | contribs)
Parse function put in correct place
Line 191: Line 191:
local generators_down = udp[2]
local generators_down = udp[2]
-- Get notation: naturals (or nominals), sharp symbol, and flat symbol
-- Get note symbols
local notation_default = { ['Naturals'] = string.sub("JKLMNOPQRSTUVWXYZ", 1, mossteps_per_equave), ['Sharp'] = "&", ['Flat'] = "@" }
-- If this param was blank, default to diamond-mos; limited to 17 note names
-- But if it's blank and the scalesig is 5L 2s, default to standard notation
-- This order of operations allows for overriding standard notation for 5L 2s
local note_symbols_main = "JKLMNOPQRSTUVWXYZ"
local note_symbols = string.sub(note_symbols_main, 1, mossteps_per_equave)
if scale_sig == "5L 2s" then
if scale_sig == "5L 2s" then
note_symbols = "CDEFGAB"
notation_default['Naturals'] = "CDEFGAB"
end
notation_default['Sharp'] = "#"
-- If a value was entered, override the default value
notation_default['Flat'] = "b"
if string.len(frame.args['Note Symbols']) > 0 then
note_symbols = frame.args['Note Symbols']
end
-- Get accidental symbols
-- If this param was blank, default to diamond-mos symbols & and @
-- unless the mos is 5L 2s, then it's sharp and flat # and b
-- This order of operations allows for overriding standard notation for 5L 2s
local chroma_plus_symbol = "&"
local chroma_minus_symbol = "@"
if scale_sig == "5L 2s" then
chroma_plus_symbol = "#"
chroma_minus_symbol = "b"
end
-- If value(s) were entered, override the default values
if string.len(frame.args['Sharp Symbol']) > 0 then
chroma_plus_symbol = frame.args['Sharp Symbol']
end
if string.len(frame.args['Flat Symbol']) > 0 then
chroma_minus_symbol = frame.args['Flat Symbol']
end
end
local notation = mosnot.parse_notation(frame.args['Notation']) or notation_default
local note_symbols = notation['Naturals']
local chroma_plus_symbol = notation['Sharp']
local chroma_minus_symbol = notation['Flat']
-- Get the gamut
-- Get the gamut