How to access lyrics programmatically?
Hi,
is there any way to access the text objects that are already in the score? I couldn't find anything in the API.
I thought I'd quickly write a plugin that would work around the problem of placing lyrics above/below the staff. The plugin could eg. have a functionality "On each line, move all lyrics syllables associated with this voice vertically to the same position where the first one is".
Thanks for your help!
Comments
Unfortunatly the current plugin framework in MuseScore 1.2 doesn't give access to Lyrics elements.
In reply to Unfortunatly the current by [DELETED] 5
Thanks for the reply. Is there any hope that this could be possible in eg. 2.0?
Or is there / could there be access to the "raw" data, something like the xml contents of a saved file?
In reply to Any plans? by nbr
Using the raw data is technically possible but not really great since that can change...
Lyric elements are accessible in 2.0. You can check a nightly build and Plugin -> Plugin Editor, click on the help icon to access the documentation.
In reply to Using the raw data is by [DELETED] 5
That plugin documentation access still doesn't work, at least not in the Windows version...
See #17688: Plugin documentation not available in the nightly builds
In reply to Using the raw data is by [DELETED] 5
Thanks for the answers so far! One more question: how do I actually access Lyrics elements in a 2.0 plugin? I tried to find them as a property of a Chord or a Note, but couldn't find anything.
In reply to Where do I find the Lyric elements in 2.0? by nbr
I'm not sure it's the best way to solve the problem for lyrics below and above the staff. If you need this, you should probably use odd and even lyrics text style and use the Y property to move the lyrics. See attached file.
Starting from c56fa93212, you can read lyrics (read only) from a chord. it will give you the list of lyrics for a chord, "vertically". I tested with
In reply to Starting from c56fa93212, by [DELETED] 5
Problem with this implementation: you get the raw sylabels only with no indication whether they form a word on their own or belong together with other sylables, information about the dash is lost. Melisma are lost too.
In reply to Problem with this by Jojo-Schmitz
Sure. It's a start ;) pull requests to expose more information about lyrics is welcome.
In reply to Sure. It's a start ;) pull by [DELETED] 5
Haven't yet found the place where - and _ in lyrics entry are handled and how they are stored in the score.
No problem with Ctrl- and Ctrl_ (they are just part of the sylable), but that's not what we'd need here.
In reply to Haven't yet found the place by Jojo-Schmitz
I added support for syllabic in 451404f6e0
In reply to I added support for syllabic by [DELETED] 5
Hi!
Is ther a similar way to access other text elements (i added some programatically via addStaffText())?
I need to remove them again before the plugin runs a second time...
(Could you implement something like tagged texts, so a text can be annotated with the plugin name or some arbitary string to identify it again for removal?)
Best Regards!
Dr Noes