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
}
The (cursor.track % 4 != 0) is not really needed since you cannot remove rests from voice 1, but it gives the impression you know what you are doing...
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
}
In reply to This is code from the New… by elsewhere
Thank you.This usage is completely correct.
In reply to Thank you.This usage is… by davil123
The (cursor.track % 4 != 0) is not really needed since you cannot remove rests from voice 1, but it gives the impression you know what you are doing...
In reply to The (cursor.track % 4 != 0)… by elsewhere
In fact, I don't know the syntax of removeElement, it can be used alone with removeElement()! This is something I didn't expect.
In reply to The (cursor.track % 4 != 0)… by elsewhere
In fact, I don't know the syntax of removeElement, it can be used alone with removeElement()! This is something I didn't expect.