Skip to main content
Topic: GroupOp.hmm 0.7 (Read 14930 times) previous topic - next topic

GroupOp.hmm 0.7

The name of this Plugin sounds strange - this is so because it is only a "support object" for copying and deleting larger "groups of items" on multiple staves. NWC cannot do "vertical selection" over multiple staves, yet sometimes it is necessary to copy a segment on all staves to some other score position. Typical scenarios are
  • expanding of verses notated with repeat marks, when later in arranging differences between the verses should be notated precisely (e.g. when the syllable counts differ; or when, for playback, different note lengths - slurs etc. - are desired);
  • during arranging, when a part that has been expanded from a particell or the like should be copied to a repeat.
From version 0.2 onwards, the tools for copying and deleting also handle lyrics correctly, which should greatly improve their usefulness.

With GroupOps, one would do the copying as follows:
  • place a pair of 'Start' and 'End' GroupOps on each staff around the segment to be copied;
  • place an 'Insert' GroupOp one each staff at the target place of the copying;
  • execute the plugin's user tool 'Copy'

Typically, the 'Start', 'End', and 'Insert' GroupOps on the staves will be lined up vertically, but this is not required. Only one 'Start', 'End', and 'Insert' GroupOp should be present on each staff; the 'Copy' tool will ignore all after the first, but it might also produce chaotic output of there are more GroupOps of a type on a staff. The 'Insert' GroupOp can be after, before or even inside the segment to be copied.
The copied result will be shown between dashed GroupOps.

The two attachments BeforeCopy.PNG and AfterCopy.PNG show the setup of a copy and the score after executing the GroupOp.hmm:Copy user tool.

Since 0.4, there is some support for expanding repeat sections with master repeats and endings; for an explanation and an example how to do this, see Reply #9 below.

With the plugin's 'Delete' user tool, it is possible to delete segments, delimited by 'Start' and 'End', on multiple staves. Also here, the 'Start' and 'End' GroupOps will typically be aligned vertically over the staves, but this is not required.
The deletion locations will be shown by newly inserted 'Insert' GroupOps.

Finally, there is a 'Reset' user tool to remove all GroupOps. This is useful if another 'Copy' or 'Delete' is done to make sure that not left-over GroupOps play havoc with the score. The example AfterReset.PNG shows the Copy example form above after the GroupOp.hmm:Reset user tool is executed.

In effect, this user plugin replaces the PHP user tools I have published in this old thread.

H.M.

Re: GroupOp.hmm 0.1

Reply #1
This reminds me of the tool 'CopyPasteMeasures' that I wrote 5 years ago.
It's also copying and pasting the lyrics.
Always look on the bright side of life!

Re: GroupOp.hmm 0.1

Reply #2
That looks like it could be very useful at times.

Re: GroupOp.hmm 0.5

Reply #3
I have now, in a major upgrade, added lyrics handling: The Copy tool copies the relevant sections of lyrics, the Delete tool deletes the relevant lyrics section and saves them in the Insert object it creates - this might be helpful if the delete was not what was intended so that the text can be resurrected (but before using these tools, backuping the file and then not overwriting the backup is strongly recommended).

I wonder why I haven't written such a gadget long ago - as a choral arranger and composer, I have done so many "repetition unwindings", with manual lyrics copying around, that I would have saved hours with such a tool - whether mine or @Opagust's. Should teach me something ...

Up to now, I've tested the new version only on a few test files and one large choral score. But I'm sure more scores will follow, so bugfixes, in case I find something, will come.

For those interested in development: The logic of when a note, or chord, or restchord, or rest does accept a lyrics syllable is not simple; if someone is interested, I have added a score with many (all?) possible hiccups in it; running the Delete tool must remove exactly the b's in the first lyrics line and the spaces (underscores) in the second. Along the way, I found two bugs in NWC, namely (a) that ties go over clefs to notes at the same position, instead of the same sounding note; and (b) nwcPlayContext.Slur is broken - it never returned true in my attempts.

@Opagust, I looked at your code in CopyPasteMeasures.og.lua and learned a little bit; but tried to do it "my way"  :D

Edit: Ah, there is a bug in my code: If there are grace notes with Lyrics set to 'Always', the lyrics counting misses a step or two. I will repair that in a few days - probably not the most important problem ...
And since I'm still running with 2.75a.2 (the last non-development build, AFAIK), nwcut.encodeText() is not yet available. I currenlty append the raw text to the Insert's properties in the Delete tool, but this will stumble with " chars, new lines and maybe more - also to be repaired.
- repaired in 0.3.

Edit: I have added an example of a note with Lyric=Never that led to a misstep of the lyric calculation that has been fixed in 0.5.

H.M.

Re: GroupOp.hmm 0.2

Reply #4
Quote
If there are grace notes with Lyrics set to 'Always', the lyrics counting misses a step or two.

From time to time I use hidden grace rests for showing the stanza number at the beginning of news lines.
But most of the times the occurrences are limited, so no hard job to correct it manually.

 

Re: GroupOp.hmm 0.2

Reply #5
Thanks for the test script.

Sometimes I want to copy the lyrics for a song in a staff with only hidden rests (to be able to move the lyrics around to different voices). Of course, this is something that comes in mind when everything is almost ready and I blame myself because creating an empty staff with hidden rests is annoying. To get this done, I was working on a LUA script to do that for me. But my alpha version script doesn't handle slurs and especially ties correctly.
With your script I can check easily where my script goes wrong.  8)

Bart

Re: GroupOp.hmm 0.3

Reply #6
I repaired the two bugs, and updated the "complex lyrics example" above to include
  • grace notes with Lyric=Always; and
  • lyrics with " and newlines that are deleted (and hence moved into string fields of a GroupOp-Insert object).

I am unsure about the following code:
Code: [Select · Download]
item.Opts.Opts and item.Opts.Opts.Lyric == 'Always'
Does this work over all (newer) versions of NWC, i.e., do they all have this doubled Opts? (I seem to remember that with .Text, it is sometimes necessary to check both .Text and .Text.Text). Is there a more idiomatic way to write the access to the Lyric field?

H.M.

Re: GroupOp.hmm 0.3

Reply #7
H.M.

I couldn't manipulate the Lyrics-switch with Opts.Lyrics.
What seems to work for me is creating a temp_item and use the Provide method
* temp_item:Provide("Opts","Lyric=Always")
* temp_item:Provide("Opts","Lyric=Never")
I didn't verify if adding other options is possible.

Bart

Re: GroupOp.hmm 0.3

Reply #8
I am unsure about the following code:
Code: [Select · Download]
item.Opts.Opts and item.Opts.Opts.Lyric == 'Always'
Does this work over all (newer) versions of NWC, i.e., do they all have this doubled Opts? (I seem to remember that with .Text, it is sometimes necessary to check both .Text and .Text.Text). Is there a more idiomatic way to write the access to the Lyric field?

Yes, that's the way to check the Lyric field. Maybe also some other fields have the double Opts, but I can't remember, since it's been a while I coded in Lua.
As for .Text and .Text.Text: That was changed in 2.8 Beta 1 (which I use).
Always look on the bright side of life!

Re: GroupOp.hmm 0.4

Reply #9
And ... 0.4, with some support for more easily expanding repeats with endings. Here is an explanation with a few pictures; I have attached the four respective scores below.

Let's say I have notated the following (how can I make the images to show? they have https: links, what else is amiss?):

<Image Link>

... and we now want to "expand the repeat", i.e. notate this without master repeats and endings. For this, I first mark the part to be copied with Start and End and put an Insert just before the final repeat:

<Image Link>

Below the score, I have shown in red the "How to handle flow" properties of the three GroupOps; they will control whether master repeats and endings vanish ("Remove"), or whether master repeats are replaced with something else ("Single" bar, in this case).

Running now the Copy tool, we get the following, somewhat cluttered result:

<Image Link>

Finally, after running the Reset tool the score looks like this:

<Image Link>

Note that quite some cleanup is still necessary. Especially the lyrics need to be converted to a single line, but also some dynamics are certainly superfluous. Still, with a larger score (4 voices SATB, some instruments), this should be quite helpful in some cases.

H.M.
 

Re: GroupOp.hmm 0.5

Reply #10
Version 0.5 contains a small bugfix with Lyric=Never notes; and updates to the documentation, including a link to this thread.

H.M.

Re: GroupOp.hmm 0.6

Reply #11
Bugfix for incomplete lyrics.

H.M.

Re: GroupOp.hmm 0.7

Reply #12
Bugfix for Delete User Tool if there are staves without GroupOps.

H.M.