Adding Lyrics via plugin

• Apr 29, 2020 - 21:07

Hi, how can I add lyrics in a plugin?

This works fine for text, however it doesn't seem to work for Element.LYRICS. What am I doing wrong?

var Text = newElement(Element.STAFF_TEXT);
Text.text = 'something';
cursor.add(Text);

Best regards,
Fernando


Comments

I don't know the specifics of the plugin syntax, but I do know something of the internal representation. I can tell you that while staff text is added to a segment/track (which is essentially what a "cursor" represents), lyrics are added to chordrests.

Which version of MuseScore do you use? For me it works as expected with Element.LYRICS type:

var cursor = curScore.newCursor();
cursor.rewind(Cursor.SCORE_START);
 
var lyr = newElement(Element.LYRICS);
lyr.text = "text!";
cursor.add(lyr);

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