Skip to main content

Topic: CueStaff.hmm (0.6) (Read 581 times) previous topic - next topic

CueStaff.hmm (0.6)
A cue staff object for NWC

Version 0.6 is a complete rewrite, which makes the object as feature-complete as I could imagine. This documentation has, on the whole, stayed as before, but many details have changed.

After @William Ashworth again mentioned cue staves in a posting, I thought I'd try to implement a full object. The CueStaff object is not easy to use, but it can create acceptable (I think) cue staves for some cases. It must be said that this is a "tricky object" - it puts notes at places you might not have expected, and it tries to undercut NWC at some places to get the desired result. A native NWC cue staff feature would be much easier to use, and create much more consistent results. However, as long as we do not have such a feature in NWC, this is the nearest I came to supplying a comparable functionality via a plugin.

Let me start immediately with the limitations of the CueStaff plugin:

  • Cue staves cannot be played (the notes sound all wrong). You need a separate playing staff to play them correctly.
  • Like the CueHeads.ms plugin, also a CueStaff uses NWC's beaming - which is of course too large for a cue staff. This is a compromise - otherwise, the plugin would have been much harder to implement; and harder to use.
  • Ties are not supported. You must, in general, simulate them with Slur.ms objects. However, in some cases, ties "do just the right thing".
  • Rests and double-stemmed chords are more complex than you'd believe.
  • Placement of accidentals and dots is not as sophisticated as NWC's. Still, it should be good enough in most cases.
  • Placement of clefs and key signatures works only by fiddling with various spacer sizes.
  • Handling of initial and final bars does not always work.

The features of the CueStaff object include:

  • Support for complete cue staves, i.e., the cue staff runs from the beginning to the end of the score (this is typically used in scores with solo instruments or voices), as well as cue segments, i.e., short staff segments above or below a main staff (this is typically used to indicate alternative musical lines, or explanatory notations e.g. for ornaments).
  • Support for single-stemmed and double-stemmed chords, rests, and rest chords.
  • Free scaling from 50% to 150%.
  • Arbitrary number of staff lines.
  • Additional "overhangs" on the left and right of cue segments.
  • Optional dashed or solid connection lines to bar lines on the next staff; transparent bars are not connected.
  • Optional clef and key signatures at the beginning of a cue staff or segment, and on each new system.
  • Separate CueStaffTimeSig object for scaled time signatures in a cue staff.
  • It is possible to suppress the staff scaling, so that only the items are scaled. This allows the placement of cue items of different sizes on a normal staff. An example for this is attached as "OverlaidCueSegment".

Here are four examples that show what can be done with this object (their NWC scores are added as attachments):

CueStaffExperiment_RheinbergerOp150Nr3Gigue.pdf
CueStaff_Chords.pdf
CueStaff_Rests.pdf
OverlaidCueSegment.pdf

The following text tries to explain the concepts behind this plugin, and how to use it.

The current implementation is feature-complete - I believe -, but the placement of some elements is certainly not perfect. I am open to all suggestions on how to create a better-looking score.

Concepts of cue staff drawing

The main concepts behind this object are:

  • The main idea is to write "source items" (notes, chords, rests, bars) in NWC's normal size that are not (or only partially) visible. Instead, these source items control how the visible "cue items" are drawn.
  • The cue staff is overlaid over the source staff. For this to work, the source staff lines are set to zero. Typically, the center cue staff line lies exactly over the center source staff line (which is invisible, because of the zero lines). It is possible to offset the cue staff lines from the source staff lines; this is not used often, but the C.Ph.E.Bach example (in the next posting) shows that by using this feature, one can align the cue staff with a grand staff brace.
  • The source notes and chords are entered with blank noteheads ("Q B" on the keyboard), with invisible dots (-1 as "Extra Dot Spacing" in the note properties) and without any accidentals. However, stems and beaming of notes and chords are visible.
  • For a note, the cue notehead is shown "somewhere near" the invisible source head - I'll explain that in detail below, but the idea is that the visible stem goes almost to the cue notehead. A short line completes the missing stem piece.
  • If the note/chord needs accidentals and/or articulation, an invisible grace note/chord immediately to its left must carry this information (I call this the "grace companion" of the note or chord, which is the "cue chord").
  • The grace companion also carries the additional heads for double-stemmed chords and rest chords, if necessary. The cue chord itself must never have two stems, because the second stem would always be at a wrong place.
  • Invisible source rests create smaller cue rests at about the same position. However, as NWC does not always place invisible items at useful locations, these rests might end up at unexpected places. As a remedy, one can also enter rest chords with a blank head, a whole notehead (or stem length zero) and an invisible rest ("Show Rest" is unchecked), which are placed perfectly by NWC. But this does not work with dotted rests, as "Extra Dot Spacing" is not saved for rest chords (this is an NWC bug) - so in this case, invisible rests must be used.
  • At its start, a cue staff or cue segment can optionally have a clef and key signature. If the cue staff contains one or more system breaks, these elements are repeated at the start of each system.
  • There is a separate CueStaffTimeSig object, which creates a scaled time signature (it looks for a previous CueStaff object to find the scale). The CueStaffTimeSig does not support "common time" signatures.

In order to use this plugin, one must understand how notehead placement works. I'll explain this in a number of steps. The blue elements in this and the subsequent diagrams represent the source items, which are typically invisible in the resulting score (with the exception of stems); the red elements are the resulting items that are drawn by the user object. The examples show the creation of a cue staff of size 75% where the center lines are on the same height.
(I have added a zip of the images to the next posting, in case they are not reachable on my server)


In the first diagram, one sees the basic mapping of a source note:

<Image Link>

First, the position of a "virtual" cue notehead on the cue staff is computed; then, this notehead is moved away from the stem to the nearest valid position. The small gap between the stem's end and the notehead is filled by the plugin with an additional short line. One can see that the note stem is now typically too long - therefore, overriding the stem length with 6 or 5.5 is usually a good idea.

This mapping concept, however, leads to a problem: The possible note positions on the cue staff are denser than on the source staff - so, some cue staff positions apparently cannot be reached from source staff positions! The next diagram shows a five-note scale on the source staff - it ends up with two "holes" on the cue staff:

<Image Link>

The solution is an additional marker that allows a notehead to be mapped one step higher. In the next diagram, this marker is shown as a small blue arrow; for the plugin, one uses the "Tie Direction Downwards" selector of the note (remember that ties are not supported; so, the tie-direction information is "free" for being [mis]used for other purposes). One can see that it is now possible to create a five-note scale on the cue staff by using four different source notes with suitably chosen "shift" markers:

<Image Link>

The direction of a notehead shift is always away from the stem. The reason for this is of course that only then is it possible to add a small segment to complete the stem on the cue staff. However, this leads to the strange effect that merely flipping the stem direction on the source note alters the cue note's pitch, as can be seen in the following diagram:

<Image Link>

I found that I got used to this behavior quite quickly. One adjusts the note position of the note immediately afterwards (with Ctrl-Shift-Up or Ctrl-Shift-Down), and all is well.

Now, let us look at chords. Here, the rule is that, first, the "outermost" nodehead is mapped as described above (i.e., the highest note if the stem points downwards, and the lowest if the stem points upwards). Then, the intervals of the chord are faithfully replicated on the cue chord:

<Image Link>

Again, this will typically lead to overly long stems, so that their length must be overridden.

The stem-flipping effect is much larger for chords, as can be seen in the following example:

<Image Link>

Stem flipping changes the outermost note, and hence, the location of the whole chord on the cue staff varies considerably. Again, I found that moving the chord quickly to the right position is not a problem (of course, sometimes it is necessary to set the "Tie Direction" to "Downward" to place the chord on an otherwise unreachable position).

The rule for assignment of accidentals is: The actual positions of the noteheads on the grace companion are ignored; its noteheads are simply mapped one-by-one in order to the cue chord or note (this picture is wrong: The stems must point in the same direction; I'll repair it soon):

<Image Link>

Articulations (staccato, tenuto, etc.) are simply taken over from the grace companion to the resulting cue note or chord.

Last, one must understand how double stemmed chords (including rest chords) work. Like the accidentals and the articulations, they draw their information from the grace companion. The cue chord (with blank noteheads) only contains the noteheads for the shorter duration (and hence no second stem). The noteheads for the longer duration are copied over from the grace companion. The position of these noteheads is derived from the grace companion's position - this is the only case where its position is important. Rest chords work similarly: The cue chord is a (typically whole) blank notehead with a rest (with "Show Rest" unchecked); the noteheads are copied over from the grace companion.

When creating double stemmed chords or rest chords, ene must make sure that the stem directions of cue chord and grace companion agree, otherwise the results are disturbingly chaotic.


Practical considerations of cue staff writing

In practice, it is a good idea to follow these steps (a user tool might be useful to support the more mechanical steps - I have not yet written one):

  • First, completely write the source staff, and set all stem directions correctly.
  • Then, duplicate the whole staff so that you have (a) a valid source against which you can compare the resulting cue staff; and (b) a staff for playback if needed.
  • Now, create the necessary grace companions for accidentals and articulations. Either you copy the whole note or chord - the keyboard sequence for this is: Shift-Right/Left (to select); Ctrl-C Ctrl-V Ctrl-V (to copy); Shift-Right, = Alt-Enter Ctrl-Tab N Enter (to make it "grace" and then invisible); Right and again Shift-Right and then one or more of 9 8 7 , ' ^ _ (to clear all accidentals and articulations). Or you copy single helper notes (with an accidental, a staccato dot, ... - whatever you need) from some other part of the score or - better yet a "tool staff").
  • For rests, add a separate whole note to create a rest chord (using whole note avoids overriding the stem length with zero).
  • Select the complete staff or segment to be "cued", and (a) in tab "Notes", set "Extra Dot Spacing" to -1 everywhere and select "No Leger Lines"; (b) set all noteheads to blank noteheads ("Q B" on the keyboard does this).
  • Set the "Staff Lines" to zero.
  • Only now the CueStaff object should be inserted, with the intended scaling. Almost all notes and chords will now suddenly have jumped to (musically) wrong positions.
  • Therefore, all chords and notes must now be shifted (again) to their correct position - by simple selecting and shifting with Ctrl-Shift-Up/Down, and maybe additionally by setting the "Tie Direction". The duplicate staff made in step 2 above is very useful for this.
  • Also, accidentals and articulations might show up wrong if the grace companions are not correct - they need to be repaired now.
  • Notehead-dependent elements - slurs and triplets - may need additional position fine-tuning (using NWC "Markers").
  • Then, additional elements like tie-simulating slurs, dynamic-simulating texts etc. need to be placed correctly.
  • Finally, the spacers of the CueStaff object should be configured; usually, this requires checking the layout via "Print Preview" (Alt-F V on the keyboard).

For editing an existing cue staff, the following hints might help: An important NWC feature is the F11 button which toggles between
  • "edit mode" - where all invisible items are shown as grey outlines; which can be helpful, but also confusing -, and
  • "viewer mode" - where items are roughly laid out by NWC as on a print output.

Additionally, there is a "Show Source" flag on the CueStaff objects, which will show the source staff lines and note/chords instead of the cue items. This is mostly useful when correcting chords, where one has to see the original intervals.

Finally, Alt-F V (Print Preview) is your friend if you want to align the cue staff clef and key signature correctly - I have found no other way than to repeatedly play with the spacers and the left overhang and check with Alt-F V, + and cursor keys whether the alignment is good enough. There is a "Show Width" flag on the CueStaff objects which shows the room used by the clef and key signatures; it might help to place them better.

In the end, however, all this is still a kludge: Native cue staff support in NWC would be much easier to use.

H.M.
  • Last Edit: 2018-07-06 10:20 am by hmmueller

Re: CueStaff.test (0.4)
Reply #1
0.2 has - well - bug fixes.

This posting has now additional examples. One is an excerpt from a C.Ph.E.Bach score, others show how a cue staff runs over a complete or part of a score.

Also, this posting contains the zip file with the explanation images for the initial posting.

H.M.
  • Last Edit: 2018-07-06 09:50 am by hmmueller

Re: CueStaff.test (0.3)
Reply #2
Being on a short holiday, I sat in a Turkish cafe in Berlin for the last 6 hours and

  • added the missing features (support for "no staff scaling"; "use stem articulation", courtesy accidentals); and
  • did a self-experiment with a Rheinberger score ...

The first resulted in version 0.3, with an additional example "OverlaidCueSegment", which shows how one can have different sizes of cue notes in a normal staff. Note placement has been completely rewritten and is now somewhat less buggy - but I still find stems that overshoot their noteheads, alas.

The self-experiment resulted in the insight that using this plugin is somewhat exhausting. I started to write Josef Rheinberger's Gigue for violin and organ (op.150 no.3). You can find the scanned score, as published by R.Forberg in Leipzig, at IMSLP as the third piece in score number 269676; and there, you can see that the violin voice is set in a smaller staff - so I set out to write this staff with the CueStaff plugin. It took me quite a long time to reach only measure 44 (of 153) - it looks roughly as it should, but writing the graces for the accidentals; and moving up and down all the notes is heavy work. On the upside, ties do sort of work (with a single voice like the violin), if one selects the "Tie Direction" in a way that also the tie is bent the right way. I have attached the incomplete, patchy score for those really (really) interested, but ...

... on the whole,  I would recommend to use this plugin for longer staves only if you are in very great need to write smaller notes. Instead of using this contraption, try to argue that scores with different staff sizes are totally old-fashioned and of no use to the modern musician - your effort is better spent in such discussions, I'd say (even, or maybe because of, being the author of this).

So much for a nicely spent day!

H.M.
  • Last Edit: 2018-06-14 04:08 pm by hmmueller

Re: CueStaff.test (0.4)
Reply #3
The Turkish cafe was open again - albeit quite full on this Friday (the weekly Islamic prayer day).

I changed the logic of the "Tie Direction Downwards" flag - now, "Tie Direction Downwards" always means "away from the stem" (and therefore, "Tie Direction Upwards" is almost useless). One now always uses the keyboard shortcut "Alt-Enter Alt-T D" to move a note or chord to an unreachable position - and this improves the workflow quite a lot, because no more thinking is necessary.

I continued my Rheinberger experiment and have now completed the violin cue staff in a raw form - i.e., all notes, accidentals and articulations are now at their correct places (I have attached the NWC file and the resulting PDF - which shows, for demonstration purposes, both the source violin staff and the cue staff). However, double-stemmed chords are needed, even for this single-line (but not always!) violin voice. So, that's a missing feature.

There are some more problems and missing features, which are summarized at the head of the Lua source ...

... but I will now stop working on this plugin until someone (me included) really needs it and stumbles over the missing features and other pitfalls. For short stretches of cue notes, the plugin is certainly useable and maybe even useful. If anyone follows this development, let me know whether you have any comments or ideas.

H.M.
  • Last Edit: 2018-06-15 02:50 pm by hmmueller

Re: CueStaff.test (0.4)
Reply #4
Thank you for this effort! I know it will come in handy one day.
Sincerely,
Francis Beaumier
Green Bay, WI

Re: CueStaff.test (0.6)
Reply #5
Here is version 0.6 - a complete rewrite which now can really do everything that is necessary ... ... I believe.
The Rheinberger example shows that one can now write a complete cue staff of a long piece in an (I hope) acceptable way.

This plugin has a few algorithms that try to imitate NWC algorithms: Placement of accidentals, placement of articulations, placement of dots, as well as notehead placement on the left or right side of a stem. The Chord and RestChord example scores in the initial posting show corresponding placements of NWC and the plugin - the plugin's algorithms are simpler, but for its limited uses better algorithms were not worth the effort.

Also, I have changed the name to .hmm, as I hope that this is a "quite final" version.

H.M.
  • Last Edit: 2018-07-06 10:52 am by hmmueller