Skip to main content
Topic: PrintConfiguration (0.3) (Read 233 times) previous topic - next topic

PrintConfiguration (0.3)

"Ok - that's it. I'm out. I quit." "What are you talking about?" "As I say: That's the end of it. No more." "What ...?" "That's got to change!"

It is often necessary to create different prints from a single NWC score. The standard example is of course printing voices, in addition to a full score; but one might also need a print of only the choral voices or a piano reduction, i.e., vocals and piano staves that have been added to a score. Unfortunately, each of the prints typically requires setting various parameters to different values:
  • Of course, the staves to be printed;
  • but typically also a different staff size is needed;
  • as well as a specific title that indicates the print's purpose;
  • and e.g. a different print preparation date (e.g. in a copyright or lyricist field).
  • In more complex cases, one might want cue notes in some of the prints (but not all);
  • and even more intricate changes like specific spacers or margins to prevent the systems spilling over onto a quite empty last page.
Remembering these print options e.g. in the Comments section is error-prone and requires tedious manual operations to make all the necessary changes.

The PrintConfiguration.hmm object is an attempt to create various prints from a single score much easier. The idea is that for each print, such an object stores all the necessary specific options. Two user tools "Save" and "Apply" are used
  • to save the current options (which are set up as always - by fiddling with them until the print looks right) into the object as strings;
  • and to apply the options stored in such an object to the score.

Conceptually, each print configuration is placed on a specific staff; this is intuitive for typical "voice prints". Therefore, at most one such object on a staff makes sense - all latter ones are ignored.

For larger prints - e.g. a full score or a print of all choral voices -, it is best to create a separate single-line top staff that is layered with the first note staff (this is helpful anyway for having different system breaks for different prints).

It makes sense to add a print sequence number or letter in the staff names, e.g. "A Full Score", "B 1st Violin", "C 2nd Violin" etc. This documents the print order; and also helps to easily select the print configuration in the user tools from the keyboard by simply typing A or B or C etc.

In addition to the PrintConfiguration.hmm object, there is a PrintVariation.hmm object which allows to modify segments of a staff arbitrarily(!) for different prints. Typical examples are:
  • add/modify spacers for a print;
  • addition of cue notes;
  • enable/disable various objects, e.g. BarNumber.hmm objects on lower staves.

For examples, see next posting.

V.0.3:
- Corrected access to bool properties;
- PrintVariation.hmm modifies previous objects so that it is useful for spacers.

H.M.

Re: PrintConfiguration (0.3)

Reply #1
Here are three typical examples using PrintConfiguration.hmm and PrintVariation.hmm objects:

PrintConfigurationExample.nwctxt is a simple example which only changes global properties of the score for two prints "1 Full Score" and "2 Trumpet" (I used digits here instead of letters; letters are better as they easily allow for ordering 26 prints).

Typically, one would print as follows:
  • Apply and print configuration 1: start user tool "Apply", type "1" and "Enter", save and print,
  • then apply and print configuration 2: "Apply", "2", "Enter", save and print,
  • finally apply print configuration 1 once more and save - you want to see the full score when you open the NWC file next time.

SinglePrintVariationExample.nwctxt shows, in addition, two typical uses of PrintVariation.hmm:
  • In measures 5 a text is shown just in the "Trumpet" print. Here, the fun text "Attention !" is inserted before the trumpet begins anew. To "remove" the text in the "Full Score", it is replaced with an invisible grace rest - removal is not possible for single items (but see MeasurePrintVariationExample below). Note that the PrintVariation.hmm is placed after the item - the reason is explained next:
  • In measure 6, a spacer is modified depending on the print configuration. The behaviour of spacers is the reason that a PrintVariation.hmm object must be placed after the item to be modifed: A spacer would not work when preceded by a user object, as this user object is then between the note and the spacer, which kills its effect on the note.

Finally, MeasurePrintVariationExample.nwctxt shows how to insert a full measure of cue notes in the "Trumpet" print. They replace the single whole rest in the "Full Score". For consistency, also here the PrintVariation.hmm object is placed after the items to be replaced - typically at the end of a measure.

H.M.

Re: PrintConfiguration (0.1)

Reply #2
And here is my first discussion posting. I have three questions, as of now:

a) Do the names "PrintConfiguration" and "PrintVariation" make sense? I had called them "ScoreConfig" and "ScoreConditional" first, but "score" is the whole NWC file, thus I introduced the term "print". For the conditional modifications in staves, "conditional" somehow sounds wrong; but is there a better term than "variation"?

b) Is the handling - using "Save" and "Apply" - ok? Actually, this is not really easy: If one forgets to "apply" previously saved settings before changing options or adding additional variations, one can end up with a chaos of options.
For the moment, the last PrintConfiguration object shows a diagonal "Active" text in edit mode so that one can see which configuration was apllied or saved last. Is this good enough?
I will add multi-print configurations to some of my small (organ + trumpet) and also larger (choir + soloists + string quartet + piano reduction) scores and check how happy I myself feel with this machinery....

c) "Staff Labels" does not work. Even when I manually tweak a .nwctxt file, this options is not correctly written into the PgSetup. I suspect this has to do with the blank in "First System", "All Systems" etc., therefore only "None" works. Is this true? and if so, how can I set the StaffLabels slot correctly with a user tool??
Solved.

Thanks for help and comments!
H.M.

Re: PrintConfiguration (0.1)

Reply #3
c) "Staff Labels" does not work. Even when I manually tweak a .nwctxt file, this options is not correctly written into the PgSetup.
I suspect this has to do with the blank in "First System", "All Systems" etc., therefore only "None" works. Is this true?
and if so, how can I set the StaffLabels slot correctly with a user tool??
No, for sure it doesn't depends on the blank.
I did this way with no problem:
Code: (nwc) [Select · Download]
    Item = nwcItem.new("|AddStaff");
    Item:Provide("Name","Perc. staff ".tostring(HighestPercStaffNumber))
    Item:Provide("Group","Percussions")
    Item:Provide("Label","Wood Blocks")
    table.insert(MidiStaves[StaffCount],Item)

Re: PrintConfiguration (0.1)

Reply #4
I don't mean to throw cold water on this, but why not just save the modified score under a different name? NWC scores only take up a teeny-tiny percentage of space on a hard drive. I do this for parts all the time.

Re: PrintConfiguration (0.1)

Reply #5
Well, let's say that there is an error in one of the staves that needs to be corrected, and that staff is present in several of the different configurations. The composer would need to make the change to each of the saved score copies. Whereas with @hmmueller's approach, only a single score would need to be updated.

I haven't yet experimented with the new objects, but I think I see how they might be very useful.

Re: PrintConfiguration (0.1)

Reply #6
Hi Heinrich,

I got this error when I ran the user tool:
Quote
C:\ProgramData\Noteworthy Software\nwc2\UserPlugins\PrintConfiguration.hmm.nwcuser.lua:145: attempt to concatenate local 'staffName' (a nil value)

When I removed the '.Text' at the end of line 142, the error didn't occur any more.
But I think it has to do with the version of nwc (mine is 2.8 beta 1).
So maybe this is the best solution:
Code: [Select · Download]
    local staffName = staff.AddStaff.Opts.Name.Text
    if staffname == nil then staffname = staff.AddStaff.Opts.Name
That works for me.
Always look on the bright side of life!

Re: PrintConfiguration (0.1)

Reply #7
Thanks, Mike. Hadn't thought of this angle.
Well, let's say that there is an error in one of the staves that needs to be corrected, and that staff is present in several of the different configurations. The composer would need to make the change to each of the saved score copies. Whereas with @hmmueller's approach, only a single score would need to be updated.

I haven't yet experimented with the new objects, but I think I see how they might be very useful.

Re: PrintConfiguration (0.1)

Reply #8
Quote
I don't mean to throw cold water on this, but why not just save the modified score under a different name? NWC scores only take up a teeny-tiny percentage of space on a hard drive. I do this for parts all the time.

Well, we all probably have our own processes. I compose and arrange directly in NWC; one day or the other, I think I'm done. I let it lie around a day or two, then go over it - and will modify some stretches. But then (or a day later), I create the PDFs (e.g. full score, choral part, maybe a piano reduction) because I am done! ...

... I thought: Certainly, I now find a number of nuisances (typically, overlapping symbols; not nicely aligned hairpins; lyrics too near or too far from notes; lyrics that deserve redistribution to syllables; ...) that need to be beautified. I do this, then it goes to our choir's conductress ...

... who will tell me which parts she'd like to have adjusted (too high, too low, too fast, too slow, too hard, oh no!). So there's a next group of small changes. And as songs often contain equal segments at various places (e.g. motifs, but also complete verses), the changes need to be done at more than one place; so of course, I overlook some of these places, and have to make another tiny change the other day.

On the whole, I'd say that I create about 10 PDF versions up to the final version (which, alas, often still has a few hiccups).

Why don't I "just wait" till the end? I don't really know - but there are probably two reasons:
a) I actually do think that I'm done when I'm not. Overlooking some missing symbols and a few typesetting issues is so easy.
b) I like to create PDF scores, and even print them, and look at them. It is quite satisfying to see one's own creation as if it were real, published music ;) .

So maybe I rush the whole thing, at places, and thus have to repeat it more often than strictly necessary. And then I complain, and then I program ...

H.M.

Re: PrintConfiguration (0.1)

Reply #9
Code: [Select · Download]
    local staffName = staff.AddStaff.Opts.Name.Text
    if staffname == nil then staffname = staff.AddStaff.Opts.Name
Thanks! (maybe I use local staffName = staff.AddStaff.Opts.Name.Text or staff.AddStaff.Opts.Name ...).This nested Text objects baffled me anyway, but it is there in my 2.75a.2

H.M.

Re: PrintConfiguration (0.1)

Reply #10
No, for sure it doesn't depends on the blank.
I did this way with no problem:
Code: (nwc) [Select · Download]
    Item = nwcItem.new("|AddStaff");
    Item:Provide("Name","Perc. staff ".tostring(HighestPercStaffNumber))
    Item:Provide("Group","Percussions")
    Item:Provide("Label","Wood Blocks")
    table.insert(MidiStaves[StaffCount],Item)
Thanks for checking. Blanks do work e.g. for title and other properties. It seems that there is a problem (mine, or NWC's??) just with the StaffLabels enum value ... maybe it has something to do with the fact that it's an enum! (I declared it as text ...).

I'll play around ...

H.M.

Re: PrintConfiguration (0.1)

Reply #11
Thanks! (maybe I use local staffName = staff.AddStaff.Opts.Name.Text or staff.AddStaff.Opts.Name ...).This nested Text objects baffled me anyway, but it is there in my 2.75a.2

H.M.

That seems a bit neater. It's been a while since I last programmed in lua, I'm in love with Python now, but that's the way I would write in Python too.
Always look on the bright side of life!

Re: PrintConfiguration (0.2)

Reply #12
V.0.2 added in root posting:
- Code to access staff name in 2.8.x (per Opagust's suggestion)
- Handling of "Staff Labels" corrected (trimming of " did the job)

H.M.

Re: PrintConfiguration (0.3)

Reply #13
V.0.3 added in root posting, replaced examples in second posting:
- Corrected access to bool properties
- PrintVariation.hmm modifies previous items (so that it is useful for spacers). Because of this, PrintVariation 0.3 is not compatible with previous versions. Also, its properties as well as the internal storage for complete measure replacements have changed.

The object is still buggy with text properties of user objects - strange things happen there, as NWC sometimes (or always?) adds quotes. I do have an idea how to repair this, but it's more work than I hoped.