Slurred lyrics - MuseScore 2

• Apr 28, 2015 - 08:40

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?


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!

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 by heuchi

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 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 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 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 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.

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