Module:Ups and downs notation: Difference between revisions
CompactStar (talk | contribs) No edit summary |
CompactStar (talk | contribs) No edit summary |
||
| Line 30: | Line 30: | ||
-- [10] = {"A#", "Bb"}, | -- [10] = {"A#", "Bb"}, | ||
-- [11] = {"B"}, | -- [11] = {"B"}, | ||
-- {12} = {"C"} | -- {12} = {"C"} | ||
-- } | -- } | ||
function p.get_note_names_table(et) | function p.get_note_names_table(et, fifth) | ||
local note_names = {} | local note_names = {} | ||
for i = 0,et.size do | for i = 0,et.size do | ||
| Line 40: | Line 40: | ||
end | end | ||
fifth = fifth or math.floor(math.log(3/2)/math.log(2) * et.size + 0.5) | |||
local fourth = | local fourth = et.size - fifth | ||
local chroma = (fifth * 7) % et.size | local chroma = (fifth * 7) % et.size | ||
| Line 95: | Line 95: | ||
num_downs = (last_major_note - i) | num_downs = (last_major_note - i) | ||
end | end | ||
last_major_names = note_names[last_major_note] | |||
for i in last_major_names do | |||
name = string.rep("v", num_downs) .. name .. string.rep("b", num_flats) | name = string.rep("v", num_downs) .. name .. string.rep("b", num_flats) | ||
table.insert(note_names[i], name) | table.insert(note_names[i], name) | ||
| Line 101: | Line 102: | ||
end | end | ||
end | end | ||