Module:Ups and downs notation: Difference between revisions
CompactStar (talk | contribs) No edit summary |
CompactStar (talk | contribs) No edit summary |
||
| Line 18: | Line 18: | ||
-- e.g. for 12edo, intended result would be something like: | -- e.g. for 12edo, intended result would be something like: | ||
-- { | -- { | ||
-- 0 = "C", | -- [0] = {"C"}, | ||
-- 1 = "Db", | -- [1] = {"C#", "Db"}, | ||
-- 2 = "D", | -- [2] = {"D"}, | ||
-- 3 = "Eb", | -- [3] = {"D#", "Eb"}, | ||
-- 4 = "E", | -- [4] = {"E"}, | ||
-- 5 = "F", | -- [5] = {"F"}, | ||
-- 6 = "F#, Gb", | -- [6] = {"F#", "Gb"}, | ||
-- 7 = "G", | -- [7] = {"G"}, | ||
-- 8 = "Ab", | -- [8] = {"Ab"}, | ||
-- 9 = "A", | -- [9] = {"A"}, | ||
-- 10 = "Bb", | -- [10] = {"Bb"}, | ||
-- 11 = "B", | -- [11] = {"B"}, | ||
-- 12 = "C", | -- {12} = {"C"}, | ||
-- } | -- } | ||
| Line 57: | Line 57: | ||
-- Add major scale notes | -- Add major scale notes | ||
note_names[major_note_idx[1]] | table.insert(note_names[major_note_idx[1]], "C") | ||
note_names[major_note_idx[2]] | table.insert(note_names[major_note_idx[2]], "D") | ||
note_names[major_note_idx[3]] | table.insert(note_names[major_note_idx[3]], "E") | ||
note_names[major_note_idx[4]] | table.insert(note_names[major_note_idx[4]], "F") | ||
note_names[major_note_idx[5]] | table.insert(note_names[major_note_idx[5]], "G") | ||
note_names[major_note_idx[6]] | table.insert(note_names[major_note_idx[6]], "A") | ||
note_names[major_note_idx[7]] | table.insert(note_names[major_note_idx[7]], "B") | ||
note_names[major_note_idx[8]] | table.insert(note_names[major_note_idx[8]], "C") | ||
-- Add sharp/up notes | -- Add sharp/up notes | ||
| Line 79: | Line 79: | ||
num_ups = (i - last_major_note) | num_ups = (i - last_major_note) | ||
end | end | ||
local | local names = note_names[last_major_note] | ||
local j = 0 | local j = 0 | ||
while j < num_sharps do | while j < #(note_names[last_major_note]) do | ||
local k = 0 | |||
while k < num_sharps do | |||
names[j] = names[j] .. "#" | |||
k = k + 1 | |||
end | |||
k = 0 | |||
while k < num_ups do | |||
names[j] = "^" .. names[j] | |||
k = k + 1 | |||
end | |||
j = j + 1 | j = j + 1 | ||
end | end | ||
| Line 132: | Line 136: | ||
local et = ET.parse(frame.args['tuning']) or ET.parse('12edo') | local et = ET.parse(frame.args['tuning']) or ET.parse('12edo') | ||
local step = tonumber(frame.args['step']) | local step = tonumber(frame.args['step']) | ||
return p.get_note_names_table(et)[step] | return table.concat(p.get_note_names_table(et)[step], ",") | ||
end | end | ||
return p | return p | ||