Module:TAMNAMS: Difference between revisions
m prefix/abbrev-verify functions only omit a prefix if the text is "NONE" or "none" |
m Changes to lookup table names |
||
| Line 20: | Line 20: | ||
-- Lookup table for tamnams step ratios | -- Lookup table for tamnams step ratios | ||
p. | p.hardness_names = { | ||
['1:1'] = 'equalized', | ['1:1'] = 'equalized', | ||
['4:3'] = 'supersoft', | ['4:3'] = 'supersoft', | ||
| Line 33: | Line 33: | ||
-- And step ratio ranges | -- And step ratio ranges | ||
p. | p.hardness_ranges = { | ||
['1:1 to 2:1'] = 'soft-of-basic', | ['1:1 to 2:1'] = 'soft-of-basic', | ||
['1:1 to 3:2'] = 'soft', | ['1:1 to 3:2'] = 'soft', | ||
| Line 51: | Line 51: | ||
-- Lookup table for tamnams extended step ratios | -- Lookup table for tamnams extended step ratios | ||
p. | p.hardness_names_ext = { | ||
['1:1'] = 'equalized', | ['1:1'] = 'equalized', | ||
['6:5'] = 'semiequalized', | ['6:5'] = 'semiequalized', | ||
| Line 67: | Line 67: | ||
-- And extended step ratio ranges | -- And extended step ratio ranges | ||
p. | p.hardness_ranges_ext = { | ||
['1:1 to 2:1'] = 'soft-of-basic', | ['1:1 to 2:1'] = 'soft-of-basic', | ||
['1:1 to 3:2'] = 'soft', | ['1:1 to 3:2'] = 'soft', | ||
| Line 89: | Line 89: | ||
-- Lookup table for tamnams names within the range of 6-10 steps | -- Lookup table for tamnams names within the range of 6-10 steps | ||
p. | p.mos_names = { | ||
['1L 1s'] = 'monowood', | ['1L 1s'] = 'monowood', | ||
['2L 2s'] = 'biwood', | ['2L 2s'] = 'biwood', | ||
| Line 130: | Line 130: | ||
-- And prefixes | -- And prefixes | ||
p. | p.mos_prefixes = { | ||
['1L 1s'] = 'monwd', | ['1L 1s'] = 'monwd', | ||
['2L 2s'] = 'biwd', | ['2L 2s'] = 'biwd', | ||
| Line 171: | Line 171: | ||
-- And abbrevs | -- And abbrevs | ||
p. | p.mos_abbrevs = { | ||
['1L 1s'] = 'wood', | ['1L 1s'] = 'wood', | ||
['2L 2s'] = 'bw', | ['2L 2s'] = 'bw', | ||
| Line 212: | Line 212: | ||
-- TAMNAMS equave-agnostic names | -- TAMNAMS equave-agnostic names | ||
p. | p.equave_agnostic_names = { | ||
['1L 1s'] = 'trivial', | ['1L 1s'] = 'trivial', | ||
['1L 2s'] = 'antrial', | ['1L 2s'] = 'antrial', | ||
| Line 225: | Line 225: | ||
-- And prefixes | -- And prefixes | ||
p. | p.equave_agnostic_prefixes = { | ||
['1L 1s'] = 'triv', | ['1L 1s'] = 'triv', | ||
['1L 2s'] = 'atri', | ['1L 2s'] = 'atri', | ||
| Line 238: | Line 238: | ||
-- And abbrevs | -- And abbrevs | ||
p. | p.equave_agnostic_abbrevs = { | ||
['1L 1s'] = 'trv', | ['1L 1s'] = 'trv', | ||
['1L 2s'] = 'atri', | ['1L 2s'] = 'atri', | ||
| Line 317: | Line 317: | ||
function p.lookup_name(input_mos) | function p.lookup_name(input_mos) | ||
local scalesig = p.preprocess_scalesig(input_mos) | local scalesig = p.preprocess_scalesig(input_mos) | ||
return p. | return p.mos_names[scalesig] | ||
end | end | ||
| Line 324: | Line 324: | ||
function p.lookup_prefix(input_mos) | function p.lookup_prefix(input_mos) | ||
local scalesig = p.preprocess_scalesig(input_mos) | local scalesig = p.preprocess_scalesig(input_mos) | ||
return p. | return p.mos_prefixes[scalesig] | ||
end | end | ||
| Line 331: | Line 331: | ||
function p.lookup_abbrev(input_mos) | function p.lookup_abbrev(input_mos) | ||
local scalesig = p.preprocess_scalesig(input_mos) | local scalesig = p.preprocess_scalesig(input_mos) | ||
return p. | return p.mos_abbrevs[scalesig] | ||
end | end | ||
| Line 343: | Line 343: | ||
-- use_extended is used to toggle between central range and extended range | -- use_extended is used to toggle between central range and extended range | ||
local key = rat.as_ratio(step_ratio, ':') | local key = rat.as_ratio(step_ratio, ':') | ||
local named_ratio = use_extended and p. | local named_ratio = use_extended and p.ratios_ext[key] or p.ratios[key] | ||
return named_ratio | return named_ratio | ||
| Line 367: | Line 367: | ||
-- use_extended is used to toggle between central range and extended range | -- use_extended is used to toggle between central range and extended range | ||
local named_ratio_range = use_extended and p. | local named_ratio_range = use_extended and p.hardness_ranges_ext[key] or p.hardness_ranges[key] | ||
return named_ratio_range | return named_ratio_range | ||