Some thoughts about Staff Type Changes improvements

• Aug 28, 2020 - 17:35

I'd like to discuss some possible improvements to Staff Type Changes and their best implementation from the user side.
Currently, I'm trying to allow Staff Changes at places other than full measures.
I've thought on a bunch of options for this and I'd appreciate some feedback.

First, some context: since I am interested mainly in contemporary engraving, I've been working mostly on the Cutaway feature, along with some improvements on Instrument Changes and Staff Type Changes.
I want to be able to (easily?) do:
- Works for percussion ensembles, with lots of changes from 5 to 1 or 2 line staves, often between pitched and unpitched instruments, like this composition from Vinicius Amaro:
- Cutaway scores, like these examples from Penderecki:
or this hand engraving from brazilian composer Agnaldo Ribeiro:

For the instrument changes, specially for modern percussion ensambles, it is of high priority to me that pitched an unpitched instruments can live together on a staff so I ended up with this PR that would hopefully be tested at some point:

For the Cutaway Part, fortunately it was implemented around 2015 by Marc Sabatella and it does most of the work of hiding measures automatically, which AFAIK puts MuseScore in front of all other notation apps!
On that matter I've been working in bringing back the missing measure barlines (maybe lost at some point when the bar lines code was improved) and also for adding these "courtesy clefs" previous to visible measures, which need a little portion of the staff to be drawn. See issue:

So, ossias and cutaway will look like this, with or without the optional clefs:

barlines and clefs in cutaway scores.png

Additionally, Staff Type Changes can be used for a manual cutaway by allowing setting the staff to invisible in the middle of the score (as also requested here: but NOT making the measures invisible so there can be text, unpitched notes, graphics or whatever objects the composer wants in these portions of the staff.
Also, there are some beautiful (manual) alternatives to Cutaway that can use Staff Changes, like turning the 'rest' measures into one-line staff instead of hiding them (example score: Or to two dotted lines like in Penderecki's Capriccio for Oboe example above.
(Btw I plan to add dotted staff lines if someone else is interested).

But for all of these, there's always the need of a portion of the new staff style to be antecipated somewhere in the previous measure.

So, now it's time to figure out how to allow staff changes at arbitrary places and not limited to full measures.
For the records, Sibelius - which only allows staff changes by adding a new instrument change every time - has a little handle that can be dragged to fine tune where the staff change actually begins. It is usually dragged to the left just enough for a clef.
Finale has "staff styles" that can be added from/to any point or 'tick' of a measure - although editing these start and end points of the style is very awkward, unless I am doing it wrong.
(Both apps use these tools also to create Cutaway scores, but unlike MuseScore, it has to be a manual process.)

From the implementation side, I understand that staff lines in MuseScore are drawn in a per-measure basis. But I learned when adding these "clef trailers" on the Cutaway issue (see image above), that it would be not too hard to have a measure drawn with more than one staff style. It would be basically a matter of adding all the needed lines to the measure's line 'collection'.

Codewise (simple) explanation, if a regular measure has these 5 lines:
┌── measure width ──┐
1 ________________________
2 ________________________
3 ________________________
4 ________________________
5 ________________________

Then a measure that changes from 5 to 1 line at a certain x position would be given this "collection" of 6 lines:
┌── measure width ──┐
1 ________________
2 ________________
3 ________________ 6_____
4 ________________
5 ________________

Now, from the user side, I have been looking for possibilities to control this:
1. A "tick offset" control in Staff Type Change inspector would allow to go from, say, -99% to +99%, so the staff change start would be "displaced" a percentage backwards to the previous measure or to further into the measure. For a Courtesy Clef, you could set it to -20% or so.
2. Being able to drag the Staff Type Change element to where you really want it (or anyhow add some visual draggable handle to the Staff Type object). And not by "tick", but by an arbitrary X position relative to the measure.
3. Being able to add a staff change to a chord or rest, as it is with Instrument Change. (this would be the most limited implementation IMO)

The disadvantages on implementation 1 is that you won't always want a proportional part of a measure, as it would be if we just 'offset' some ticks (a fraction).
Thinking more pragmatically: the main need for this as far as I can tell is to add a staff "trailer" before a Staff Type Change, and usually just the right size for a Clef. In this case, a 'portion' (i.e. 20%) of the staff would be proportional to the measure width so it would look fine if a measure has a certain width, but ugly if the measure was wider and insufficient for the clef if the measure is condensed.
This would add the need for a control in absolute distance (ex. 4.0 sp) as well as proportional - and this starts to become a messy and overkill addition.
At the same time, the second option above would put things more into control but then, would need manual adjustments all over the piece if a page layout changes and measures get wider/tighter.

So, maybe instead of all this control, what about:
4. just a checkbox in the Staff Type Change inspector to "add staff trailer" and just add the 4.0 needed for a clef?

Or even
5. just make an automatic "anticipation" of the Staff Type if a 'courtesy clef' is present in the previous measure, before the barline? No control would need to be added but it would cover only this case use. (would work similar to the image above but not only from invisible to visible)

Any feedback and thoughts on this will be appreciated.

Attachment Size
barlines and clefs in cutaway scores.png 86.75 KB

Do you still have an unanswered question? Please log in first to post your question.