as i read Note names can be used in script,
instead of integer values.
Is it also possible to get the string from an integer
value?
I know Ivould make my own string array,
but maybe it is already available ?
Peter
as i read Note names can be used in script,
instead of integer values.
Is it also possible to get the string from an integer
value?
I know Ivould make my own string array,
but maybe it is already available ?
Peter
Be careful. Note names in GP Script are NOT strings - they are integers. They’re just a convenience.
Having said that, it’s pretty trivial to write a GP Scripot function that will return a string representation of a MIDI note number. For example
var
notesInOctave : string array
function NoteNumberToString(n : integer) returns string
var octaveNumber : integer
semitone : integer
octaveNumber = (n / 12) - 2
semitone = n % 12
result = notesInOctave[semitone] + octaveNumber
end
initialization
// Initialize the names of each notes in an octaive
notesInOctave = ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"]
end
Now you can just use the function NoteNumberToString as needed. Note there’s no checking to make sure the incoming value is in fact between 0 and 127 so if you send it a bogus value all bets are off (save your gig!!!)
O.K., I will save my Gig !
Peter