Slurred lyrics - MuseScore 2
How do I go about finding out if a particular chord or note belongs to a slur?
I'm working in improving the lyrics export for my ultrastar exporter.
I have to insert line breaks, and I've decided to do them by word.
I've found the Lyrics.syllabic, and making a break on single or stop is OK. This fails, though, when one word is slurred over multiple chords or for tied notes. There's only the one syllable at the beginning, and the following chords don't seem to have lyrics. I've found the notes.tied property, and that helps. I can't find out how to tell if notes or chords are slurred, though.
Where would I find the slur information?
Comments
Problem is that syllabic and slur don't need to coincide.
You can have one without the other and also instead if a slur it could be a tie.
In reply to Problem is that syllabic and by Jojo-Schmitz
Quite right. I need all of those points. Syllabic, tie, and slur. Right now, I've got syllabic and tie but can't find the slur info.
What I have to do is be able to say "if syllabic (start, middle, end) or tied or slurred then don't make a line break."
I'Ve had a look through the source for libmscore, and it looks like the slurs are stored as elements on the chords, and the elements aren't exposed through QML. I'll see if I can expose that list and see if the slurs are in there. Recompile from source. Wheee!
In reply to I'Ve had a look through the by Joseph Eoff
Slur -> SlurTie -> Spanner and that has startElement and endElement
So Slur.startElement and Slur.endElement should be available?
In reply to Slur -> SlurTie -> Spanner by Jojo-Schmitz
Yeah, if the Slur elements are really in the Chord elements list. Can't check right now, supposed to be working. :)
In reply to Yeah, if the Slur elements by Joseph Eoff
If you find out, let me know, so I can color them in the ColorVoices plugin too ;-)
I tried to understand how this works and I'm afraid slurs don't seem to be accessible in plugins, because I only found lines in the core that get them by calling Score::spannerMap(), which is not exposed to QML as of now. I also don't know if simply exposing this method is the desired way of giving access to spanner elements in plugins. As far as I understand, one would need to search the map for elements, that cover the current tick and track.
In reply to I tried to understand how by heuchi
Hi.
I thought that they were on the chords because at one point in chord.cpp there is check if some element is a slur - but it seems there really aren't any slurs in there.
There is a method in score.cpp (isSpannerStartEnd) which looks like it will give me what I need. I'll try it, then we can discuss whether it ought to be exposed for the plugins.
In reply to I tried to understand how by heuchi
OK. That helped a lot. isSpannerStartEnd lets meknow for sure if a slur starts at a particular spot. It doeesn't say whether it started or stopped, only that it changed. So, I'll have to track the current state of slur/no slur and toggle on isSpannerStartEnd. Workable if not ideal.
So, can we get Score::isSpannerStartEnd exposed to QML? The change is trivial, but I don't know if there's a good reason not to include it.
In reply to OK. That helped a lot. by Joseph Eoff
Hm, I don't understand how you want to track slurs when you only know if there is a spanner starting or ending at a given note, but don't actually get any information about it.
Just changing the state form start to end and back every time isSpannerStartEnd() returns true will probably not work, because ties (and even glissando, hairpins and trills) are also spanner elements, so without a reference to the actual spanner element, you cannot even be sure a slur exists at such a note.
In reply to Hm, I don't understand how by heuchi
Hmmm. That actually sounds like a good thing.
The idea is to keep lyrics together onscreen that belong together.
Glissandos, trills, slurs, and ties meld a bunch of syllables together in to one long, wandering "note," so they need to stay together.
The hairpins do the the same, but for the volume of the notes. Seems to me like the affected syllables should then stay together, too.
The idea isn't to represent the items (slurs, ties, etc) on screen - Ultrastar and friends can't do it, and the file format doesn't support it.
Ok, overlapping spanner elements could be a problem. I could scan through the score elements and create a simplified spanner map and fix things up that way.
All I need to do is figure out when not to put a line break in the text. isSpannerStartEnd seems perfect for that.
In reply to I tried to understand how by heuchi
Well, that was a bust.
I got what I wanted (rather less than more) from isSlurStartEnd, but it turns out I can't go that route.
Words are too short, so the play back in performous keeps skipping them in an attempt to keep up with the music. Sometimes it skips a word or two, sometimes the display just stays blank because the playback program can never decide which text to display.
So, I'm going ot have to make it so that the user can mark line ends in MuseScore. I made a quick test, breaking lines on the / character in the lyrics.
The manual breaks work fine, so now it is just a matter of finding something less obtrusive (and ugly) than a mark in the song lyrics. I'm thinking of maybe a text field attached to a note or a chord. Once they are in, they could be made invisible so as not to make the score look ugly.
In reply to Well, that was a bust. I got by Joseph Eoff
A StaffText should be an easy way to go. And they can be found in a plugin via the annotations property of a segment.
See here for how to find a TempoText. But it works the same way for StaffText (Element.STAFF_TEXT).
In reply to A StaffText should be an easy by heuchi
I'll try that, and set the marks to invisible when exporting.