How to remove notes

• Sep 28, 2015 - 14:08

Hello
How can i delete, remove a single note by a plugin in Musescore 2

with:
CURSOR.element.remove(CURSOR.element.notes[0])
Musescore crashes

Can you please help, many thanks
PimPim


Comments

I was browsing some of the posts on plugins as I recently created one to delete notes actually....

I was getting crashes too in my attempts to delete notes from a QML script...

The trick seems to be to keep in mind that any given note has a parent Chord. So you have to call the remove method from the "chord" object...in this sample, I've got an array of notes...get the chord from the note's parent and call the remove from the chord object...that seems to keep the memory/object heap happy:

for ( var n = 0; n < notesToDelete.length; n++) {
var chord = notesToDelete[n].parent;
chord.remove(notesToDelete[n]);
}

Do you still have an unanswered question? Please log in first to post your question.