removeNote

• Nov 8, 2014 - 15:04

Hello,

I'd like to remove some note from a partition with a plugin.

I made all the note i don't want invisible, but when i export in musicxml format or midi format they are still here;

chord.removeNote(i) don't do anything.

Can someone point me in the right direction or post a solution ?

regards,


Comments

chord.removeNote works fine for me - I assume you are talking about 1.3? But you need to realize, it isn't meant for removing *chords*, but rather removing *individual notes from within chords*. That is, if you start with a chord of several notes, and do removeNote on one of those notes, it will remove that note from the chord, leaving the others intact. I am not sure there is a way to remove the entire chord, so one a chord of only one note, I wouldn't be surprised if removeNote was disabled.

It might helkp if you explained more what you are trying to do - why your score has all these invisible notes that you want removed - and perhaps someone can suggest an alternate solution.

In reply to by Marc Sabatella

thank you for the help. I wrote a program that work for marking all the notes invisible.

I wrote this to no avail :

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();
}
}
}
}

Some notes should be wiped out. nothing happens.

regards,

In reply to by jrp.nop

Mark them silent or just delete them, or don't enter them in the first place?
There must be more to it, there got to be a reason why you are having this 'excess' notes, but so far I have no idea why, can you share the score and describe what you want to achieve?

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