How do I get to STEM to force them upward using a plugin?

• Aug 3, 2021 - 21:56

I would like to take the brass/sax figures and paste them into the Drumset part. Then I'll run a plugin that make them a Dark Orange, 3rd voice, small noteheads, no slurs, and force the stems upward. I can't seem to get them or slurs. Can anyone help with problem?

Below is a partial listing of the code (forgive me for not mentioning names):

function nameNote(note) {

    var tpc = note.tpc1 + 1;
    var tonenote = tpc % 7;

    var name = [" ", " ", " ", " ", " ", " ", " "][tonenote];

    // Notes are on the correct line.
    note.fixed = true;
    note.fixedLine = -1;

    // Make notes small.
    note.small = true;

    // Note is set to specific pitch.
    note.pitch = 71;

    // Note is set to a color (Dark Orange) of a 3rd voice.
    note.color = '#b93d00';

// Element.stemDirection = 'Up';;
// note.stemDirection = 'UP';
// note.chord.stemDirection = 'UP';
// note.chord.stemDirection = 1;
// note.stemDirection = 1;
// note.stemDirection = 'Up';1;
// chord.stemDirection = 'Up';
// note.chord.stemDirection = 'Up';
// note.stemDirection = 'Up';

    // Switch notes to 3rd voice.
    note.voice = 2;

    // Added 7/21/2021.
    name = "";

    return name; 
}

function nameNotes(cursor, measureMap) {

    if (cursor.element.type !== Element.CHORD)
        return;

    var text = newElement(Element.LYRICS);
    text.text = "";
    var notes = cursor.element.notes;

    var sep = "";
    for (var i = 0; i < notes.length; ++i) {

        text.text += sep + nameNote(notes[i]);
        sep = "–";
    }
    if (text.text == "")
        return;

    text.verse = cursor.voice;
    cursor.element.add(text);
}

As always, thank you for your help.


Comments

note.parent.stemDirection = Direction.UP should turn the stem up. Here note.parent points to the chord which is a parent of the note, and the value of stemDirection property can be one of the values from Direction enumeration, that is , UP, DOWN or AUTO (for an automatic choice).

BTW, are you aware that the built-in Tools / Toggle Slash Notation does a good chunk of this and more already? You need to move to voice 3 yourself (done easily with Tools / Voices / Exchange Voice 1-3), and color orange yourself as well if desired, but the making small and upstem - and above the staff, and silent - happens automatically then.

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