Is there a default notes table, with all of them available, some sort of structure that looks like:
notes = { 1= “C-0”, 2= “C#0”, 3= “D-0” … }
Or do I have to build it myself?
Thanks.
Is there a default notes table, with all of them available, some sort of structure that looks like:
notes = { 1= “C-0”, 2= “C#0”, 3= “D-0” … }
Or do I have to build it myself?
Thanks.
Been using this for my midi script learning, may be of some use even though it has the extra hex field?
edit: couldnt get the expanding code boxes to work, so here
s the full thing:
In addition there is also this from taktik`s F&R script .
local valid_notes = {}
for octave = 0,10 do
valid_notes["C-"..octave] = true
valid_notes["C#"..octave] = true
valid_notes["D-"..octave] = true
valid_notes["D#"..octave] = true
valid_notes["E-"..octave] = true
valid_notes["F-"..octave] = true
valid_notes["F#"..octave] = true
valid_notes["G-"..octave] = true
valid_notes["G#"..octave] = true
valid_notes["A-"..octave] = true
valid_notes["A#"..octave] = true
valid_notes["B-"..octave] = true
end
valid_notes["---"] = true
valid_notes["OFF"] = true
You can also build a table using a function… no need to manually define them:
midi_notes = {}
note_table = {"C-", "C#","D-","D#","E-","F-","F#","G-","G#","A-","A#","B-"}
function build_note_table()
local current_midi_note = 0
for octave = 0,9 do
for notepos = 1,12 do
current_midi_note = current_midi_note +1
midi_notes[current_midi_note] = note_table[notepos]..tostring(octave)
if current_midi_note == 128 then
break
end
end
if current_midi_note == 128 then
break
end
end
end
very helpful, thanks
not to hijack,but would something like that also work for chords??