Module:MOS notation: Difference between revisions
Quickly added support for abbreviations for mosstep-quality-to-degree function; default is no abbreviations to avoid breaking existing templates |
Fixed issue (hopefully) with nominal-accidental function producing a longer chain than the degree function, despite passing the same chain lengths |
||
| Line 152: | Line 152: | ||
--local genchain = { root } | --local genchain = { root } | ||
local root_offest = (i - 1) * mossteps_per_period -- To make sure that, across all periods, every note has a unique index | local root_offest = (i - 1) * mossteps_per_period -- To make sure that, across all periods, every note has a unique index | ||
-- Create | -- Create the genchain | ||
local genchain = { } | |||
for j = 1, genchain_length_per_period do | for j = 1, genchain_length_per_period do | ||
-- Convert the accumulator into an index | -- Convert the accumulator into an index | ||
local index = accumulator % mossteps_per_period | local index = accumulator % mossteps_per_period | ||
| Line 166: | Line 163: | ||
-- This is negative if the genchain is descending | -- This is negative if the genchain is descending | ||
local accidentals_to_add = 0 | local accidentals_to_add = 0 | ||
if j > genchain_init_per_period then | if j > genchain_init_per_period + 1 then | ||
accidentals_to_add = math.ceil((j - genchain_init_per_period) / mossteps_per_period) | accidentals_to_add = math.ceil((j - genchain_init_per_period + 1) / mossteps_per_period) | ||
end | end | ||
if not going_up then | if not going_up then | ||
| Line 180: | Line 177: | ||
-- Add the note name | -- Add the note name | ||
table.insert(genchain, note_name) | table.insert(genchain, note_name) | ||
-- Increment the index by the generator | |||
accumulator = accumulator + gen_in_mossteps | |||
end | end | ||