Skip to main content

Topic: CueStaff.test (0.4) (Read 127 times) previous topic - next topic

CueStaff.test (0.4)
A cue staff object for NWC

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.
  • Double-stemmed chords are not supported. You must use layered staves (which might be a little bit of a nightmare).
  • Like the 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 objects. However, in some cases, ties "do just the right thing".
  • Rest chords are not supported. You must fake them with with texts.
  • Rests are more complex than you'd believe.
  • Placement of accidentals is not as sophisticated as NWC's. Still, it should be good enough in most cases.
  • Placement of a clef, key and time signature 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).
  • 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, key and time signatures at the beginning of a cue staff or segment, and on each new system.
  • 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 to the second posting of this thread.

Here are three examples that show what can be done with this object (they are also added as attachments):


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 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.
  • 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, stem length zero (or a whole notehead) and an invisible rest ("Show Rest" is unchecked), which are placed perfectly by NWC.
  • At its beginning, a cue staff or cue segment can optionally have a clef, key signature, and/or a time signature. If the cue staff contains one or more system breaks, these elements are repeated at the start of each system.

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

Finally, here is the rule for assignment of accidentals: The actual positions of the noteheads on the grace chord (or note) are ignored; its noteheads are simply mapped one-by-one in order to the cue chord or note:

<Image Link>

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

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 invisible grace note and chords 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 grace and 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 corresponding grace notes/chords 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 signatures (clef, key, time 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.
Maybe separate "CueClef" and "CueKey" StaffSig objects would be easier to use.

However ... well, this is still a kludge: Native support would be much easier to use.

  • Last Edit: 2018-06-15 02:45 pm by hmmueller

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

This posting also has an additional example score showing how differently sized cue items can be added to a standard staff. It also shows that the object works quite nicely with the CueStaff plugin.

  • Last Edit: 2018-06-15 09:59 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!

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

  • 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.
Francis Beaumier
De Pere, WI