Casting Off


I’ve been a Lilypond user for several years, but have been very excited to try Dorico. I’ve been enjoying the trial version over the last few weeks, and find the output to be most impressive (not to mention that being back in a graphical interface is very refreshing!). One thing I’m struggling to understand, however:

One of the things I greatly admire about Lilypond is that it does an excellent job of casting off in such a way that it fills pages evenly, and doesn’t leave “ragged” pages and systems at the end of the score. It’s certainly not perfect, but with a few simple tweaks, you are able to arrive at a very nicely-spaced score. Daniel’s blog post on page layout (Development Diary #11) discussed the differing ways that the various scoring programs handle this, and noted that the “other” applications tend to simply fill pages until they’re full, often leaving just a system or two (or even a few measures) for the last page. The post seemed to suggest (at least to me) that Dorico would handle this more intelligently.

However, in my experience, Dorico seems perfectly happy to push the last two measures of a flow onto a new page, and doesn’t really seem to have any preference for producing “a pleasing layout that uses the appropriate (not necessarily minimal) number of pages.” Of course, it makes sense that the program wouldn’t be re-evaluating the layout every time a new note is entered, etc., as this would be computationally intensive. However, I’m wondering if there is some tool in Engrave mode that I’m missing that would assist finding a pleasing layout once note entry is complete. The closest thing I’ve found is adjusting the note spacing for the layout. However, while this triggers a re-evaluation of the page layout, it still does so with no preference for full systems or pages.

Am I missing something here? I certainly don’t intend this as a harsh criticism. Dorico does a truly incredible job with virtually every other aspect of spacing that this stands out (to me, at least) as the one missing piece of the puzzle.

Thanks for any input and suggestions.


I don’t think you’re missing anything. Dorico does a much better job than Sibelius at automatically casting off, but it’s not perfect (if perfection is even possible!)

It’s been mentioned that in future we’ll be able to create “note spacing change” events inside a flow, so the spacing can be tweaked in localized areas. This will help a lot, I think.

I would like a “fit to x pages” command in Engrave mode, too.

I’ve come from Finale, where locking measures to systems and “knocking” a measure back, or forward, is both easy and compulsory.
In Dorico, it seems to me that while you can manually force the number of measures per system, you don’t really need to. I get the best results from adjusting the note spacing – and the staff size – for the best fit on the page.

If you make sure that Dorico always justifies the last system, then it does pretty well at the end, but that is the one system that might need manually fitting together.

… and sometimes almost as frustrating to get what you really want as playing Whack-a-mole :wink:

I don’t claim to be an expert in how LilyPond works, but as I understand it, it uses an algorithm for casting off that is based at least in part on John Gourlay’s paper “Optimal line breaking in music”, which is itself based on the Knuth-Plass line breaking algorithm as used in TeX. We evaluated this algorithm some time ago and found that its performance characteristics are unfortunately not suitable for our real-time application as things stand.

The algorithm that Dorico uses at the moment is simplistic in comparison to the Gourlay method, though we tested it against it and found that it produced very similar results a lot of the time. However, one definite weakness that it has in comparison to the Gourlay algorithm is that it does not produce a globally optimal solution: in other words, it basically runs only one way, from the start of the layout to the end, whereas the Gourlay algorithm essentially operates on the entire layout all of the time. Dorico’s algorithm does have a refinement that means it tries to distribute any unevenness towards the end of the layout over the last few systems (the exact manner in which it does this is a bit of a secret), but this is not always going to produce a perfect result.

We are certainly keen to make further improvements to Dorico’s page layout and casting off features over time, but it’s a non-trivial problem (to say the least).

Thanks, Daniel, for the thoughtful explanation. I can certainly see how this type of algorithm wouldn’t be feasible as a real-time calculation every time notes are entered, etc. It is indeed, as you say, a non-trivial problem. However, I wonder if in the future, it could be a feature of the Engrave menu that could be run after all notes are input, etc., as part of the engraving workflow. Lilypond offers various constraints as to how this is accomplished, including number of systems per page (or, for greater flexibility, max or min systems per page), total page count, etc. It doesn’t always come up with an optimal solution by default, but with a fairly minimal amount of tweaking these settings, you can typically find a layout that works really well. I don’t pretend to understand the intricacies of whether or not this would play nicely with the current page layout model, but if it’s possible, it could be a powerful addition to the present capabilities.

Thanks again for the insights.

Yes, it would certainly be possible to have a non-real-time “cast off my score optimally” feature in the future.

One thing that would be useful is “Fit to x pages” or “Put x systems per page”. Dorico lays out notation beautifully, but very often it gives me 13 pages, or a couple of bars of a new page. So to get it down to 12, I either have to go through forcing bars together (which usually doesn’t work because D has already laid it out optimally), or I reduce the staff height by a fraction, which works well.

I get that Dorico’s philosophy is to do it all for me, but sometimes I need to tell it what I want a bit more.

This is at the moment my main problem with Dorico. As a new user I was able to input easily and quickly almost from the beginning. Even considering the fact that I am used to Finale and SCOR4 input. However, the solution of Dorico for layout was a disaster. 3 systems on some pages, 4 on other pages and 1 system on the last page. I was able to fit the right number of measures to all systems after a lot of trial and error, but I still can’t figure out how to move 1 system to a previous page. If I could do that at least I could do the layout manually since I know exactly what I want. I don’t think I understand this thing about frames and the “help” doesn’t help me at all. Could somebody explain step by step just what one has to do to take a system from one page and put it on another? Without this Dorico is useless for me.

You can move a system from one page to the previous one by selecting the note in the first bar at the start of the previous frame, then select the last note of the system that you want to become the final system of that page, then use the Make Into Frame button.

OK, i tried this, but it’s don’t work … perhaps something i did’nt understand
here a video for showing how i did this …

it’s private access, only those who have this link can see this video.
i made this video with screenpresso, A brilliant and cheap software!!!

I did it as Daniel said but I got a mess. It squeezes all measures together in one line and it is almost impossible to use the create system feature to get new systems out of it. It worked on some pages pretty well but took way too much work. There has to be an easier way to do this. One page I still can’t get the measures to separate enough so you can see them. I wish I could send you a picture of the chaos that was created. I am still struggling to get it to look like I want it.

Update: After entangling all the chaos in the systems I have the layout like I want. 4 Systems per page, 16 pages. But some of the pages have perfectly spaced systems and some don’t (too close together). I am sure I am doing something wrong but I can’t figure out what.

It says ‘video is unavailable’?

with this link i think is better

you’ll have to make this video ‘unlisted’, not ‘private’. With private, it only works if you manually share this with specific google/YouTube accounts.

ok sorry, i update the status in ‘unlisted’

i made 4 attempt to resolve this problem, and now it’s ok, but I highlighted some bug and strange behavior …

see here

Cher Thomas,

J’ai regardé le debut de ta vidéo… si tu veux tout mettre sur une seule page, il te faut selectionner le début de ta page (donc la première note du premier système) et la dernière note que tu veux sur ta page. J’utilise ctl-click pour ça. Ensuite la commande Make into frame. Et ça fonctionne parfaitement depuis la première version :wink:
Si c’est le bazar et que les portées se chevauchent, tu peux reduire la taille de tout ce monde là en modifiant le space size, dans les Layout options, page setup (j’utilise Dorico en anglais pour être raccord avec ce qui se dit ici, c’est plus simple finalement)
Hope it helps !

Hey MarcLarcher, you wrote in french !?!

is like chinese for people who’re reading this forum !!!
If we are a lot of french users of dorico, should we have to create a french forum here ?

See the 4th video, i explain my error, but it’s showing some other bug …
You’re right, for my future video screen shot, i should have to put my dorico in english …