Module:Scale tree: Difference between revisions
Added default comments as part of the module to make sure the scale signature is written correctly |
No edit summary |
||
| Line 51: | Line 51: | ||
function p.scale_tree(frame) | function p.scale_tree(frame) | ||
local mos = MOS.parse(frame.args[ | local mos = MOS.parse(frame.args["tuning"]) | ||
local equave = mos.equave | local equave = mos.equave | ||
local L = mos.nL | local L = mos.nL | ||
| Line 57: | Line 57: | ||
local collapsed_et = ET.new(L, equave) | local collapsed_et = ET.new(L, equave) | ||
local abstract_bright_gen = MOS.bright_gen(mos) | local abstract_bright_gen = MOS.bright_gen(mos) | ||
local collapsed_bright_steps = abstract_bright_gen[ | local collapsed_bright_steps = abstract_bright_gen["L"] | ||
local equalized_et = ET.new(L + s, equave) | local equalized_et = ET.new(L + s, equave) | ||
local equalized_bright_steps = abstract_bright_gen[ | local equalized_bright_steps = abstract_bright_gen["L"] + abstract_bright_gen["s"] | ||
local result = "" | local result = "" | ||
local depth = frame.args[ | local depth = frame.args["depth"] or 5 | ||
local step_ratios = sb.sb_tree_ratios(depth) | local step_ratios = sb.sb_tree_ratios(depth) | ||
-- Default comments; these correspond to the TAMNAMS-named step ratios | -- Default comments; these correspond to the TAMNAMS-named step ratios | ||
local default_comments | local default_comments = {} | ||
default_comments[ | default_comments["1/1"] = "Equalized " .. MOS.as_string(mos) | ||
default_comments[ | default_comments["4/3"] = "Supersoft " .. MOS.as_string(mos) | ||
default_comments[ | default_comments["3/2"] = "Soft " .. MOS.as_string(mos) | ||
default_comments[ | default_comments["5/3"] = "Semisoft " .. MOS.as_string(mos) | ||
default_comments[ | default_comments["2/1"] = "Basic " .. MOS.as_string(mos) | ||
default_comments[ | default_comments["5/2"] = "Semihard " .. MOS.as_string(mos) | ||
default_comments[ | default_comments["3/1"] = "Hard " .. MOS.as_string(mos) | ||
default_comments[ | default_comments["4/1"] = "Superhard " .. MOS.as_string(mos) | ||
default_comments[ | default_comments["1/0"] = "Collapsed " .. MOS.as_string(mos) | ||
-- Get comments | -- Get comments | ||
| Line 81: | Line 81: | ||
-- p/q: comment text as a string | -- p/q: comment text as a string | ||
-- Each entry is then entered as a semicolon-delimtied list | -- Each entry is then entered as a semicolon-delimtied list | ||
local comments_unparsed = frame.args[ | local comments_unparsed = frame.args["Comments"] or "" | ||
local comments = p.parse_kv_pairs(comments_unparsed) or {} | local comments = p.parse_kv_pairs(comments_unparsed) or {} | ||