replace note with rest
Hello,
I made all the note i don't want invisible, but when i export in musicxml format or midi format they are still here;
I'd like to replace a lot of notes from a partition with a rest in a plugin.
Can someone point me in the right direction or post a solution ?
regards,
I wrote that that don't work :
function run()
{
if (typeof curScore === 'undefined')
return;
var cursor = new Cursor(curScore);
for (var staff = 0; staff < curScore.staves; ++staff) {
cursor.staff = staff;
for (var v = 0; v < 4; v++) {
cursor.voice = v;
cursor.rewind(); // set cursor to first chord/rest
while (!cursor.eos()) {
if (cursor.isChord()) {
var chord = cursor.chord();
var n = chord.notes;
for (var i = 0; i < n-1; i++)
if (chord.note(i).visible == false) {
chord.removeNote(i);
}
}
cursor.next();
}
}
}
}
Comments
Why don't you just remove those notes from you score? Why marking them invisible anfd then try to remove them thru a plugin rather than not creating them or removing them from the score via 'normal' means, like select, Del?
In reply to Why don't you just remove by Jojo-Schmitz
Thank for reading my post.
My question was not how to do it manually.
Still waiting for a comment to the point.
In reply to Thank for reading my post. My by jrp.nop
If I'd understand you reasons, I may have ideas how to solve your problem
If you don't want these invisible notes to sound, just set their velocity to 0
In reply to If I'd understand you by Jojo-Schmitz
I'll try that. Thanks. EDIT : but no sugar, it didn't work :-)
For the moment I resolved it with replacing the note with rest - but it won't work for some cases (when there are more than one note in the same place ie two or three note and there is only some i don't want in the chord) :
if (typeof curScore === 'undefined')
return;
var cursor = new Cursor(curScore);
for (var staff = 0; staff < curScore.staves; ++staff) {
cursor.staff = staff;
for (var v = 0; v < 4; v++) {
cursor.voice = v;
cursor.rewind(); // set cursor to first chord/rest
while (!cursor.eos()) {
if (cursor.isChord()) {
var chord = cursor.chord();
var n = chord.notes;
if (chord.note(0).visible == false) {
var lng = chord.tickLen;
var rest = new Rest();
rest.tickLen = lng;
cursor.add(rest);
}
}
cursor.next();
}
}
}
In reply to I'll try that. Thanks.For by jrp.nop
The slash notation plugin does successfully set velocity, to 1 rather than 0, for the cursor to progress through the score.
In reply to The slash notation plugin by Jojo-Schmitz
I rewrote everything.
It's working now.
thanks for reading me and trying to help.
regards.