Skip to main content
Topic: Do we need a "CueStaff" plugin? (Read 3366 times) previous topic - next topic

Do we need a "CueStaff" plugin?

Some of us have wished that NWC would have an option to have (vertically) smaller staffs - I call them cue staffs, but they are used for multiple purposes (alternative notes for other instruments, or in different manuscripts; solo voices in piano scores; and some more).

I have played with the idea of writing a plugin that can, in some quite limited way, produce such staffs - see the (very incomplete) example in the attachment (produced by actual code - I can scale it, and the noteheads and accidentals already are plaed at about the right spots).

I would still heartily wish that NWC would have this as a built-in feature - but in the meantime (however long it will be), would such a plugin be useful? I ask because writing it would be lots of work - essentially, one has to mimic all the possible printing features of NWC - from chords and notes with their various durations (beamed and with tails) to accidentals, articulations, triplets, slurs, all the different bars, ... etc.

Would this be worthwhile??

H.M.

Re: Do we need a "CueStaff" plugin?

Reply #1
I have a need for cue notes as another NWC staff metrics setting (I know,there's a tool for cue notes), but I don't have a need for a cue staff.  Other users will, but if, as you say, it's a lot of work, maybe it can be left to Eric to develop.  I think it could be achieved if the Page Setup Fonts Staff Metrics could be set for each system rather than the entire score.

Re: Do we need a "CueStaff" plugin?

Reply #2
I too have thought about this sort of plugin, and agree that it would be a lot of work. However, while looking at your example, I had a different idea on how to accomplish it, which might be slightly less work (but still not inconsiderable). Would you be willing to describe your approach so far in the sample code? If it's not the idea I just had, I'll let you know, and you can tell me which of the two ideas might work best.

Re: Do we need a "CueStaff" plugin?

Reply #3
It would certainly be nice to have. But I admit that I wouldn't use it frequently. Thank you both for your plug-in work!
Sincerely,
Francis Beaumier
Green Bay, WI

Re: Do we need a "CueStaff" plugin?

Reply #4
Hi H.M.
I  believe many of us would find this useful, but I'm not certain the amount of use it would get would really justify the effort.  Only you can judge that.

For myself, it's probably only been maybe 4 or 5 times in all the years I've been using NWC that I really wished I had this.  It would be lovely to have available, and if it was I'd probably use it quite a bit, but it isn't an essential for me.

I plays 'Bones, crumpets, coronets, floosgals, youfonymums 'n tubies.

Re: Do we need a "CueStaff" plugin?

Reply #5
If it's not the idea I just had, I'll let you know, and you can tell me which of the two ideas might work best.
I have attached my current (very incomplete) code and the sample file.
The idea is:
  • There are two NWC staffs and, additionally, the "mirror drawing" above the second staff
  • Staff 1 is the lower one you see - no problem here
  • Staff 2 contains the notes to be mirrored.
    -- In the print version, it gets staff color white (you have to set "Highlight 4" to white  - I never needed it), and it gets layered over Staff 1; only the user objects get color black (you have to set "Highlight 5" to black). One could also set some things that can be scaled and moved up manually (e.g. texts, probably many user objects) to black and not mirror them.
    -- While editing, it is not layered and gets some visible color.

The main "distributor" in the code is the "mirror" table; and right now I have only implemented calls for Chord and Note in there and a dummy (single line) for Bar.

The main work to be done is note and bar drawing - correct positioning (right now, not even the bars line up exactly, because I do not compute the center); for notes, all the articulation, then beams and tails, triplets and slurs; but also drawing the staff keys (where the placement depends on the current clef ... ... ... ) ... And I do have problems at line breaks - can be seen in the example. Interestingly, lyrics should work out of the box, because it can be offset far enough ...

An important problem with this approach would be that all the user plugins that cannot themselves scale and shift cannot be used; in these times of patching up NWC with more and more plugins, that will decrease the value of such an object more and more (cloudy thought: "Recursive execution" of user plugins is missing from NWC - i.e., if a user plugin stumbles over another one by way of :find, the first one whould have the ability to call its _draw - and _play??? - methods, but additionally do something to the output - x/y-scale and shift it for draw, modify the resulting queue objects for play ... now that would be some sort of meta-machinery ...)

Last, the plugin has a very weird problem: It does not work if I open the example too quickly - then, draw the notes are not drawn (but the cue staff lines are visible). I have no idea why this happens - is there a (very small?) time limit such that draw simply gets killed? But would that really happen with only the few items in the test file ... ...? If this cannot be solved, the whole idea is useless anyway ...

H.M.

Re: Do we need a "CueStaff" plugin?

Reply #6
Your method is basically the same as my "newer" idea, using the Span class, to scan over and mirror the notes in smaller size, using the various nwcdraw methods to determine the appropriate locations of stem, dot, accidentals, etc.  I see from your code that you have "stubs" for the majority of staff objects that need to be filled in.

There is code in NWC which will "shut down" any plugin that is taking too much CPU time. You may have already seen this in action if you accidentally create an infinite loop (which I have done from time to time). If this is happening for you with the current code, then perhaps this technique isn't going to work.  However, maybe there is a bug lurking that is causing the plugin to run excessively. I don't recall if there is a way for a plugin to log the execution time, however.

One small note/suggestion for your current code that draws bar lines: nwcdraw.barSegment. Look at the code for TabStaff.nw for an example of this.

All in all, this is an excellent proof of concept, but as you say, it will take much work to build it out to handle more notation.

Editorial comment follows:
What would be helpful for this (and other) objects would be some way to tell NWC to "not draw things" so that the user object could draw them instead. Objects like this (as well as CueHeads.ms and Beam.hmm and a few others) are forced to use special tricks like blank space noteheads and zero-stem-length notes in order to suppress the drawing of noteheads and flags. We can currently use the marker object to suppress the rendering of slurs, articulations and triplet markings, but there are more things that would be useful to be able to hide or control.  However, I don't know what NWC has in store for the next version, since the author has been very quiet lately. Perhaps there will be other mechanisms available that give us some of the new features and abilities that we are trying to do via plugins.  I guess we'll have to wait and see.

Re: Do we need a "CueStaff" plugin?

Reply #7
I had another idea, that is much more feasible - I'll describe it in the next days -- right now I'm too exhausted from a day of trying to make it work, and ... well ... I got pulled two teeth two days ago, and it hurts.
Anyway, in the attachment is
  • an example printout, which shows that some things look as they should (this is from a C.Ph.E.Bach organ sonata),
  • the score,
  • and the current code.
The latter two are not for the faint of heart, I fear ... especially, of course, as long as I don't explain concepts and details ...

I think this is the nearest one can get with current NWC features to a cue staff; one learns that a potential user would need a detailed "how-to" guide to produce such cue staff bars, because it's honestly trickery; even rests are non-obvious.

Also, there are hard limitations: No chords with two stems, no restchords, and I think I will fail at the linebreaks, and maybe even at cue staffs that include staff signatures (clefs and keys) on the left side. I'll probably force this idea through until I run out of ideas ... but it's more of a programmer's riddle than, probably, a feature that could be sold to anyone.

H.M.

 

Re: Do we need a "CueStaff" plugin?

Reply #8
I could not stop thinking about the problem, and so ... I wrote such a plugin, based on a third idea.

H.M.