Detecting Slurs and Ties

• Aug 31, 2017 - 07:29

I'm attempting to write a plugin to simplify quickly pasting lyrics a-la Noteworthy.

Noteworthy lyrics are entered on a freeform text page, and applied to the score using a simple set of rules: '-' and ' ' break syllables, and '_' are treated as non-breaking spaces.
While this is not necessarily as intuitive as the Musescore approach, it turns out to be much quicker when it comes to copying and pasting whole parts.

I can see how to do everything else, but it is not obvious how to tell if a note/chord has a slur or tie associated with it, and I want to treat slurred/tied notes as single syllables.

Yes, I'm aware of the copy and lyrical paste, but I count this approach as "better than nothing" rather than good... (sorry!)
It is not helped that the current version of the "Copy Lyrics to clipboard" tool loses the dash marks... which someone has to have deliberately coded.


Just to be clear - you are aware that MuseScore already does almost exactly what you describe, the only difference being that you have to press Ctrl+V one syllable at a time? That is, You 8can* type lyrics into a text editor, select / copy the whole thing, then click a note and start pressing Ctrl+V to paste a syllable at a time, with separators working exactly as you described?

Instead of building a plugin - which I have no idea if it's possible - I'd suggest maybe just extending the current facility to add a command to automatically do the job. Probably a matter of adding a "loop until done" aroudn the current code...

In reply to by Marc Sabatella

Yes, I am aware, This is the approach that I consider to be "better than nothing", but because it doesn't pay attention to slurs and ties. it's a time consuming process at best. In my specific example I was converting "Shosholoza" (a South African folk song) from Noteworthy. It's five parts, and I wanted to be able to print each part separately, which involved copying the lyrics into each part. This proved to be a painfully slow process,
In Noteworthy it would typically take minutes or seconds to align the lyrics in each part, but it took me a very long time indeed in Musescore.
Issue 1): Having to manually pay attention to joined notes was mistake prone
Issue 2) The Undo is disabled in this process, so any mistake requires stuffing about with text editors to work out what's in the clipboard
Issue 3) The Copy Lyrics tool does not export the dashes between syllables.

So the question goes back to, how to detect slurs and ties, which I can't easily where they might be found. I'm an experienced programmer, I'm OK if it turns out to be complicated, I just want a clue where to look... or to know if it isn't exposed in the api.

Any help appreciated... (this is a really neat product, BTW...)

In reply to by Robbie Matthews

Again, I have no insight into if this can be done via plugins, I can just repeat - if there is an issue with how this facility works right, then I think a far more valuable use of your skills would be improving it in the code itself.

Btw, ties work fine if you include the underscore. I guess maybe you were expecting not to need that if the pitch doesn't change?

In reply to by Marc Sabatella

Repository cloned, build environment built, first pass to actually change to Copy Lyrics tool built and already useful.
However, the nightly build (MingW, anyway) seems pretty unstable... is this a known thing? Should I just wait for a bit for things to settle?
And if I wanted to include my changes to the lyrics tools, is there somewhere to discuss the best way to incorporate them?

In reply to by Robbie Matthews

Fantastic! I do think actually improving the core software is the better way to go here.

I would suggest start a new thread in the Technology Preview forum about your proposed changes. I gather there are reasons why the existing "Copy Lyrics to Clipboard" functions the way it does - I think it is more for copying lyrics to other documents in other programs than for facilitating copy and paste within MuseScore. We wouldn't want to inconvenience those other use cases by adding unwanted hyphens. But perhaps there would be room for two separate commands - one that copies as plain text, one that copies in a way that facilitates copying back to MuseScore. Or, as has long been discussed, some sort of lyrics editor facility - a dialog box within MuseScore where you can type lyrics, maybe also change order to of verses, etc.

In additional to discussing possibilities on that forum, do checkout the #musescore channel on IRC and the developers mailing list. See for more info on code contributions.

In reply to by Marc Sabatella

Thanks, and I'm keen to help. As stated, I have some ideas about Lyric management, and also I think the Plugin Creator and Manager could do with some TLC.
However, current nightly release is REALLY unstable (crashes within minutes... pretty much as soon as the score tries to scroll. Also, the slurs look weird...)
I have investigated using 2.2 (so as to have a more or less stable platform for trying out ideas and to get my hand in) but it definitely requires different versions of QT etc to compile.
If someone could point me towards a recipe to build 2.2 (which version of mingw, which version of qt, what qt.bat should be) that would help a lot, as I've already spent a lot of today fiddling and still can't build it.

In reply to by Robbie Matthews

When you plan to start/contribute on the plugin manager, please open a topic (in technology preview) beforehand; I'm currently (but slowly due to available time) investigating some of the differences/issues with instantiating plugins. Better synch ideas beforehand to avoid duplicate effort :)

In reply to by jeetee

I shall. On windows in the both the current release and the nightly build, the save/save as functionality is a little off... when you go to save an edited file, it complains that it can't determine the file type... (looking at the code, it is expecting it to be "qml", can't work out why it thinks it isn't.)
Also, the save/save as logic is a bit wonky, in that you can't actually "save as" once you've hit save.
The other (related/annoying) issue attempting to develop plugins, is that you seem to need to restart Musescore to get it to pick up changes.... some sort of refresh functionality may not go astray.
I can more-or-less see the changes to make, but I'm struggling with my build environment at present. I can't get QtCreator in windows to play well with the CMakeLists.txt... and it's so very slow on windows. (Yes, I could probably configure a linux environment, but it seems a big step...)

In reply to by Robbie Matthews

If you encounter crashes on master, it would be good to report them via the issue tracker. While it is indeed unstable in general, it should be perfectly possible to use it for testing / development - just avoi doing whatever it is you are discovering causes crashes. Or volunteer to fix the crashes you find :-) Anyhow, doing development on 2.2 is not a good option - the code probably won't be able to be merged.

Not sure what you mean about save / save as, I've never encountered any problems. Feel free to start a new thread on that and describe the problems you are seeing in more detail.

As for getting the Windows build going under QtCreator, the instructions in the Handbook have usually worked very well for me; if you are still having trouble, do ask with more detail on IRC or the developers list. It is true Windows compilers are quite a bit slower than on Linux for the same hardware, but I have pretty slow machine (an Intel fanless "mobile" Core m3 processor) and a full build can be done in under an hour, turnaround for most code changes is just a couple of minutes.

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