Module:MOS degrees: Difference between revisions
No edit summary |
Trying something with default params |
||
| Line 12: | Line 12: | ||
function p.mos_degrees_frame(frame) | function p.mos_degrees_frame(frame) | ||
-- Default parameters for input mos and step ratio (5L 2s and 2:1 step ratio) | -- Default parameters for input mos and step ratio (5L 2s and 2:1 step ratio) | ||
local | local input_mos = mos.parse(frame.args['Scale Signature']) or mos.new(2, 5, 2) | ||
-- Step ratio | -- Step ratio | ||
local | local step_ratio = mosnot.parse_step_ratio(frame.args['Step Ratio']) or { 2, 1 } | ||
-- Get the number of mossteps per period and equave | -- Get the number of mossteps per period and equave | ||
| Line 34: | Line 30: | ||
-- two instead. | -- two instead. | ||
-- If it's 5L 2s, default to the second-brightest mode. | -- If it's 5L 2s, default to the second-brightest mode. | ||
local | local udp_default = { periods_per_equave * math.ceil((mossteps_per_period - 1)/ 2), periods_per_equave * math.floor((mossteps_per_period - 1) / 2) } | ||
if scale_sig == "5L 2s" then | if scale_sig == "5L 2s" then | ||
udp_default = { 5, 1 } | |||
end | end | ||
local udp = mosnot.parse_udp(frame.args['UDP']) or udp_default | |||
local generators_up = udp[1] | local generators_up = udp[1] | ||
local generators_down = udp[2] | local generators_down = udp[2] | ||
| Line 50: | Line 44: | ||
-- This order of operations allows for overriding standard notation for 5L 2s | -- This order of operations allows for overriding standard notation for 5L 2s | ||
local note_symbols_main = "JKLMNOPQRSTUVWXYZ" | local note_symbols_main = "JKLMNOPQRSTUVWXYZ" | ||
local | local note_symbols_default = string.sub(note_symbols_main, 1, mossteps_per_equave) | ||
if scale_sig == "5L 2s" then | if scale_sig == "5L 2s" then | ||
note_symbols_default = "CDEFGAB" | |||
end | end | ||
local note_symbols = frame.args['Note Symbols'] or note_symbols_default | |||
-- Get accidental symbols | -- Get accidental symbols | ||
| Line 63: | Line 54: | ||
-- unless the mos is 5L 2s, then it's sharp and flat # and b | -- 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 | -- This order of operations allows for overriding standard notation for 5L 2s | ||
local | local sharp_default = "&" | ||
local | local flat_default = "@" | ||
if scale_sig == "5L 2s" then | if scale_sig == "5L 2s" then | ||
sharp_default = "#" | |||
flat_default = "b" | |||
end | end | ||
local chroma_plus_symbol = frame.args['Sharp Symbol'] or sharp_default | |||
local chroma_minus_symbol = frame.args['Flat Symbol'] or flat_default | |||
-- Override values for testing | -- Override values for testing | ||