How to use the removeElement() function

• Jun 7, 2023 - 12:48

234.png


Comments

This is code from the New retrograde plugin with my fix re. removing rests in internal voices:

while(cursor.segment && cursor.tick < endTick) {
var e = cursor.element;
// do not remove rests from internal voices:
// you lose the segment if you do
if ((cursor.track % 4 != 0) && (e.type === Element.REST)){
// do nothing
}
else if(e.tuplet) {
removeElement(e.tuplet); // you have to specifically remove tuplets
} else {
removeElement(e);
}
cursor.next(); // advance cursor
}

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