Adding a chord symbol from a plugin at a position where there is no note.

• Jul 6, 2020 - 13:02

I’m writing a plugin that would embellish the harmony of a jazz lead sheet. In other words, it wants to add new suitable chord symbols halfway between existing ones where appropriate.
This works when there is a note at this position, but not when there is no note. In that case the new chord symbol gets added at the next note (see attached: added symbol in red).

I borrowed this code from another plugin:

function setCursorToTime(cursor, time){
while (cursor.segment) {
var current_time = cursor.tick;
return true;
return false;
}// end setcursor To Time

var harmony = newElement(Element.HARMONY);
harmony.text = newchord;
setCursorToTime(cursor, newtime); //newtime = 960 in the example

Neither (or ‘stops’ at this empty space.
Any suggestions? All help appreciated.


If there is no note in any voice of any staff there, there is no segment, so no surprise you can't get to it. You'd have to create the segment somehow. No idea what might exist to support that within the plugin framework, but a hack might be to add rests in another voice, then add the chord symbol, then delete the rests.

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