how to create chords properly? (MS3.3)

• Nov 1, 2019 - 21:46

Greetings there,

I am trying to programmatically add chords to a score in MuseScore 3.3.0.8737 (4761df6).

Code (modulo typos - it was manually copied):

function addChord(cursor, pitches) {
for(idx in pitches) {
if (idx==0) {
cursor.addNote(pitches[idx]);
} else {
var note = newElement(Element.NOTE);
note.pitch = pitches[idx];
cursor.add(note);
}
}
}

cursor.rewind(0);
addChord(cursor, [60, 64, 67]);
addChord(cursor, [60, 63, 67]);
addChord(cursor, [60, 64, 67]);
addChord(cursor, [60, 63, 67]);

Now this gives me a first beat with a bunch of overlapping notes/noteheads, with the rest of the beats only containing individual root notes (60) without upper notes; as if the upper notes never got their position in time right, but instead get added at time index zero.

How should I do this properly?

Thank you in advance.


Comments

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