Update note pitch value
I am working on a plugin that updates note pitch values. However, some notes reflect the updated values on the score, and others do not.
Example:
var refPitch = cursor.element.notes[0].pitch;
cursor.next();
while (cursor.segment != null && cursor.tick <= endTick) {
if (cursor.element.type == Element.CHORD) {
cursor.element.notes[0].pitch = refPitch;
}
cursor.next();
}
When the script ends, the pitch values for the notes are correct, but the displayed score doesn't reflect the changes. Is there a function to redraw the score?
Comments
The tpc's (tonal pitch classes) should be changed, too, if that's what you want.
In reply to The tpc's (tonal pitch… by [DELETED] 1831606
Fabulous! Thank you!
Consider wrapping your edits between a
startCmd()
andendCmd(false)
call to make it an undo-able action.I have that same question. Coloring the notes in a score by a dialog plugin often does not change anything visually unless you scroll the score the tiniest bit. So I guess, bmiller793's code changes the pitches but the score on the page doesn't. Probably until the score is scrolled.