Create note with tie back

• Oct 10, 2019 - 09:10

Pretty straightforward: How to create a note and (depending on some rules) add a tie back to it? It does not seem possible to mess around with the tieBack property of the Note element, as it is read only.


In reply to by jeetee

I just realized than running cmd('tie') in my plugin does add a tie from a note to the next, but only to the note previously selected (clicked) in the GUI. If no note is selected, it does not do anything. Is there a way to explicitly instruct which note should the cmd affect?

FYI, if anyone else is trying to get this to work; I did manage to do so. Code snip below. Full qml which did it attached. Code snip was run against a measure with three D notes on it, starting with the whole measure selected.

if(oCursor.element.type === Element.CHORD) {
iTk = oCursor.tick;
console.log("\n------------------------------ | CHORD at Tick ", iTk," | ------------------------------");
console.log("---- Chord Contains <", oCursor.element.notes.length,"> Note\n");
// Try adding a tie
// select a single note - NOTE: will clear the range selection.
var oNote2Tie = oCursor.element.notes[0];
var bNoteSelectionOk = false;
bNoteSelectionOk =[0], false);
if (!bNoteSelectionOk) {
console.log(" ***** ERROR **** SELECTION RETURNED FALSE");
else {
console.log("We should have now selected a single note, so now add a tie");
// Re-establish the selection range and go look for the tie we added
if(oCursor.element.type === Element.CHORD) {
if(oCursor.element.notes[0].tieForward != null) {
var oTieStartNote = oCursor.element.notes[0].tieForward.startNote;
var oTieEndNote = oCursor.element.notes[0].tieForward.endNote;
console.log("---- ---- Note [", 0, "] has a Tie Forward: startNote Pitch <", oTieStartNote.pitch, "> endPitch <", oTieEndNote.pitch, ">");

Attachment Size
01_FigureOutTies_02.qml 5.85 KB

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