GSoC 2020 Week 2 BC (Before Coding): Repeats, Rests, and Counting Overview

Posted 6 months ago
Previous post Next post

Hello, everyone! I’m Isaac Weiss, and I’m very happy to be able to devote my next few months to working with MuseScore through Google Summer of Code. As part of the program requirements, I’ll be blogging here weekly to document my progress. According to the official timeline, coding should begin June 1st, but during this “community bonding period” I and the other students are already studying, experimenting, and planning. This week, I would like to share the outline of what I intend to accomplish.

Measure repeats

Two-measure repeat

I’ll start with the one you are probably most excited about: after nine years of discussions and false starts, the two-measure repeat symbol is coming to MuseScore! It will be in the Repeats & Jumps palette. You will be able to either drag it into the measure where you want it to start, or select that measure (or both measures) (or the barline in between) and click on the palette icon. Then it will look like this:

2-bar repeat.png

“Hold on, Isaac,” you say. “What’s that funny gray thing?”

That is the “Don’t Break” formatting mark, a bonus feature that will be a side effect of the implementation (sort of like when Peter Jonas/shoogle’s Semi-Realtime MIDI Input project also gave us the “Regroup Rhythms” tool). Like a non-breaking space in text, it will group the two measures and prevent them from being separated by a line break. It is necessary in order to prevent this from happening at the end of a system:

2-bar repeat bad.png

But it will also be available for use in other contexts, providing another feature first requested nine years ago. (MuseScore actually already has some code to support this under the hood, but it didn’t work right and was never finished, so it has always been hidden. I hope to fix it up around the last week of June.)

Note also that, unlike the one-measure repeat, the two-measure repeat commonly includes a number. In case you don’t want that, it will be possible to disable it on an individual basis via the Inspector, or score-wide via the Style window.

Four-measure repeat

Same as the above, only more so. To show you what it looks like, this is from a tutorial for a rival scorewriter:

4-bar repeat outriggers.png

Of course, I will not ask you to “enter the symbol in the 2nd bar of the 4 bar repeat,” but rather in the first measure (it will also work to click the palette icon with all four measures selected, or with the middle barline selected).

I think the “outriggers” in this example make it much easier for the person reading the music, so I will be sure to provide support for those, too (again, with easy enable/disable via Inspector and/or Style).

The “Don’t Break” (by the way, that's a rather clumsy name—please suggest different names in the comments!) will be even more important for the four-measure repeat, for obvious reasons.

Automatic numbering of single-measure repeats

Sometimes you want to repeat a single measure multiple times, like this:

1-bar repeat counting 1.png

Admittedly, that’s a somewhat extreme example. But it demonstrates the essential problem: the musician’s eyes glaze over, and he or she loses track. To solve this, I hope to add (time permitting—this is not the highest priority) a new option to automatically number them, according to your preference, like, for instance, this:

1-bar repeat counting 2.png

or this:

1-bar repeat counting 3.png

This, too, has been requested a number of times before.

What will not be included

I know people will ask, so I want to address it at the outset: I have decided to implement only the two- and four-measure repeats. These are notations that exist and are standardized. They work well with the common four-measure phrase structure (incidentally, so do the old-style multimeasure rests I’ll discuss below). But there is no commonly used three-measure repeat, or five-measure repeat. SMuFL does not provide them, and neither will my GSoC project. Similarly, though there have been requests for a single-measure repeat that plays more than once, it is nonstandard, it would cause an unnecessary moment of confusion for the person reading it, and it is not on the agenda.

Multimeasure rests

H-bar rest appearance controls

The other half of my project has to do with multimeasure rests. Currently, in MuseScore version 3.4 and earlier, if you enable multimeasure rests, you can’t make choices about their layout and appearance. Everything is fixed. But this is not necessarily ideal. Here are some of the options provided by a competing software:

Dorico H-bar options.png

I aim to have all of these controls implemented in MuseScore. And I’ll let you in on a secret: two of them are already done. It turns out (5) has been in there for ages, tucked away in a different part of the Style dialog (don’t worry, I’ll be putting it with the other options). As for (1), which MuseScore users have particularly requested, before this project started I just went ahead and implemented it to prove that I could. It works like a charm:

Capture.gif

And it will be included in the upcoming MuseScore 3.5! You can check it out right now in the alpha release.

Old-style rest symbols

Finally, we get to the part that I'm most excited about. There is a traditional alternate notation for multimeasure rests, where, instead of a generic H-bar with only the number to tell you how long it is, the symbol itself also conveys that information. For those unfamiliar with them, here is a simple explanation provided by one of MuseScore's competitors:

Dorico old-style rests.png

I can only speculate as to why these have fallen out of fashion—it may have been a result of composers “rebelling” against binary groupings, and of course in jazz charts they’e inconvenient to draw by hand—but I personally have come to like them, and if you’re re-engraving an old edition that uses them you should absolutely have the option. And, of course, users have been asking for this for years, too.

So, in addition to the Style options for the various aspects of H-bars described above, MuseScore 4 will provide a checkbox to enable these old-style rests, and a parameter (defaulting to 9) for the limit beyond which H-bars will still be used.


That's all for now. I welcome your comments, questions, and suggestions for what to call the “Don’t Break.” See you next week!

Previous post Next post

Comments

Excellent! The two-bar repeat is of course the one most people will be using the most, so it is the one to be sure we get right, and I think what you are proposing is sound. For the four-bar, I would kind of expect the "outriggers" to look like mmrest with the vertical strokes on the end, but it would be good to find examples of this "in the wild".

FWIW, the feature I personally expect to use the most here is the automatic counting for single-bar repeat count. A couple of things it would be good to make configurable here - the interval but also the start number. E.g, in your example, instead of the count starting with 1, I also see it starting with 2. The idea being you may want the number to reflect the total number of times the figure is played, not just the number of additional times after the first. That way an eight bar phrase ends with "8". And playing a measure eight times total is far from an extreme example. It would actually be exceedingly common in drum parts for jazz/rock/etc.

Regarding old-style mmrests: we have a function that already knows how to write a long rest in terms of shorter one so that, for example, after entering an eighth note into the start of a measure, the remainder of the measure is filled out correctly. At least, it is in simple meter - eg, in 4/4, you get eighth, quarter, half. To some extent these old-style mmrests are just an extension of the same idea, maybe it could be implemented as part of that same function, or at least have the "brains" of the algorithm refactored for use in both places. And while you're at it, finally fix it it to work for ordinary measure-filling in compound meter :-)

I look forward to working with you further on all this!

In reply to by Marc Sabatella

Thanks, Marc!

Unfortunately, I don't have much access to "the wild", but if you can find any references in your personal collection I would be grateful to see them.

Re: "you may want the number to reflect the total number of times the figure is played, not just the number of additional times after the first": I realized that this is what I've actually seen in sheet music, and I updated the images in the post (actually before I saw your comment). In other words, I would like to officially un-endorse what I originally showed. But I guess it could be configurable.

For the old-style rests, my thought was to add the SymIds to a vector using a couple of loops, e.g. while (counter >= 4), while (counter >= 2), and finally if (counter == 1), and then draw everything from the vector into one symbol. I'm not sure how similar this is to the rest duration calculations you mention; for one thing, the sequencing always goes largest to smallest regardless of context.

Question: will these measure-repeats be correctly interpreted by MuseScore's built-in playback and actually make the same sounds as the previous measures? Or are they for engraving- purposes only? Even if they do not affect playback, I think they will still be very useful for score writing. Thanks

In reply to by Isaac Weiss

Regarding numbering of repeated bars: Gould's advice is "The first statement of the material is labelled '1'. Never number the first repeat as '1': this is very confusing for the player who is playing the material for the second time." (page 578 in my copy). This seems very clear and forceful advice and should be followed at least for the default case.

The "old style" binary rests would be delightful. I hope they are not at the bottom of the todo list.

In reply to by Isaac Weiss

Returning to the numbering of repeated bars, it is frequently the case that numbering starts with '1' over the "written out" statement of the repeated material rather than '2' over the first repeat sign. I can imagine that implementing this could be troublesome as it is not clear (to me at least) what the number '1' would be anchored to (the midpoint between bar lines perhaps). Of course the workaround of adding a '1' as stave text anchored to a convenient note or rest already exists.