|
Open the font menu on the Hegazy–Gourlay Workbench and there's a new name, second in the list after Bravura: November 2. Its designer, Robert Piéchaud, has kindly allowed it to appear there. The same bars, under the same rules and the same settings, can now be set in it and compared directly with the ten fonts Ooloi bundles. Why NovemberNovember began in 1998, and its model, in Robert's own words, is Universal Edition in Vienna around the turn of the twentieth century, when it began publishing Schoenberg, Berg and Webern. That's one of my favourite looks in printed music, and it's why Ooloi's documentation already recommends November 2 as its notation font. From now on, examples on this blog and in the documentation will use November 2 alongside Bravura. I personally prefer November 2, but Bravura is the reference font of SMuFL and Ooloi's default for any piece whose house style names no other, and both belong in front of the reader. Fourteen GlyphsNovember 2 is a commercial font, and it isn't bundled with Ooloi. Nor is the font itself on the workbench. What the page carries is the 14 glyphs its examples draw: their outlines, bounding boxes and anchors, the font's engraving defaults, and its copyright line. No font file goes out with the page. Ooloi itself will use November 2 only on computers where it has been bought and installed. It's available from Klemm Music. What to CompareThe spacing rules know nothing about any particular glyph. Every font gets the same rules, the same settings and the same placeholder values, and the geometry comes from each font's own outlines. So every difference you see between two fonts on the page is a difference of ink.
Leave the settings where they are, then switch between Bravura and November 2 in the font menu. Some places to look:
As before, change one setting at a time, start near r = 0, and zoom in: many of the differences are about a tenth of a staff space. My thanks to Robert Piéchaud, for the font and for the permission.
0 Comments
There is a new two-stave example on the workbench. In its second bar, the upper stave has two eighths, a triplet, a quintuplet and a sextuplet; in the lower, a triplet of eighths, four sixteenths and a triplet of quarters. I was dragging the gauge into compression, as I do with every new example, when the lower stave stopped looking right. At −0.35 the sixteenths weren't evenly spaced, and neither were the triplet eighths before them. In each group the first note stood apart from the rest, as if it had been given a little more time. To me, that spacing is the signature of the computer engraving far too many people have grown used to after decades of exposure. Under a beam the stems form a comb, and the eye reads any irregularity in it as rhythm. Wide, narrow, wide on every beat puts a small lengthening on each beat's first note and a breath before the next: the print doing the performer's job, and badly. Even visual rhythm isn't negotiable. Working with Hegazy and Gourlay's model on the workbench has made it plain that this is what engravers do instinctively, and that irregularity disturbs the visual harmony of a page. So it had to go, and the first question was what in the model had put it there. One RasterThe cause was in Ooloi's own structure. Every stave in a system is spaced on one shared raster: a column wherever any stave has a note, and between neighbouring columns a gap that behaves as one of Hegazy and Gourlay's springs. Each gap has an ideal width, from the durations, and a minimum, the closest its ink allows. Where the other stave's notes fall between two of a stave's notes, that stave's interval is cut into several gaps. Under compression the old rule let every gap give up the room above its minimum. A gap between two notes of the same stave has a real minimum: 1.38 spaces here, the least distance between two noteheads in succession. A gap between a note in one stave and a note in the other has none of its own, since nothing in it can collide; the stave's two notes are kept apart by a constraint spanning both gaps. So a cut interval had its whole width to give, and an uncut one only its room above 1.38. The cut ones shrank faster, until the constraint caught them. At −0.35, three equal triplet eighths came out 1.783, 1.380 and 1.783 spaces apart: the upper stave's second eighth cuts the middle interval, and nothing cuts the outer two. The sixteenths, cut in the middle by the upper stave's triplet, went 1.653, 1.380, 1.380, 1.653. The rule was tidy: every gap reached its minimum at exactly the same moment, at full compression. A single stave can never show what's wrong with it, because there every interval is one gap. It took two staves with interleaved tuplets, and once they were there the fault turned up in four of the bar's seven groups. The lower stave's triplet had its middle interval 23% narrower than its neighbours, its sixteenths 17%; the upper stave's triplet had 13%, and the quintuplet 12%. The lower stave just shows it worst. A Second WitnessWhat the cure had to do followed from the cause. A cut interval must give exactly what it would give whole, so a gap's share of the compression has to depend on the time it spans and on nothing else. The gaps of a cut interval then add up to the interval, whatever falls inside it. Before changing anything, I went to LilyPond's source. LilyPond's spacing rests on the same springs, and its source is open, so reading it is the nearest thing to comparing notes with someone who's worked through the same equations. Its note springs give by duration: how much a spring yields is fixed, when the spring is built, by the time it spans, and the collision minimum only stops it. A cut interval gives what the whole would, and a part's equal durations stay even. On the evidence of the source, LilyPond seems to have reached the same judgement. It also showed me I'd been wrong. In 'Vestigia Nulla Retrorsum' I wrote that shrinking by the room above collision was LilyPond's default as well. It's LilyPond's rule only between barlines, clefs and the like, never between notes. Two QuestionsSo I made every gap compress in proportion to its ideal width. The evenness was there at once, and on the workbench it looked exactly like what engravers do. It also broke casting off. Ooloi chooses where systems break by pricing every candidate system, with Knuth and Plass's method as TeX uses it. The price depends on how far a system is compressed, measured against how far it could go. TeX's constants mean what they say only if the end of that scale, r = −1, is the tightest the system can be: here, the point where ink would collide. Priced proportionally, a system whose gaps have their minimums at 80% of their ideal widths reaches its collision limit at r = −0.2, with a badness of 0.8, which TeX's scale calls nearly perfect. Priced as before, the same system scores 100. The line-breaker would have crammed systems to the edge of collision and thought them a bargain. The mistake was asking one rule to answer two questions. How tight is this system? That's the line-breaker's question, and it's still answered against the collision limit. How should the room be shared among the notes? That's placement's question, and it's now answered in proportion to the durations, at a ratio of its own that fills exactly the width the breaker priced. Ooloi already worked this way when stretching: the breaker prices the stretch, and placement hands it out through weights that send it into the white space between noteheads. Compression now works the same way. Both stages share one set of minimums, so nothing the breaker accepts can collide when it's placed. This is also where Ooloi and LilyPond part company. My first fix had done what LilyPond does, one law for pricing and placing, but inside a price whose constants assume the collision limit sits at r = −1. LilyPond's price makes no such assumption: its spacer measures a line by a force that isn't tied to any collision limit, and prices compression through a penalty of its own. On its own terms that's coherent. Ooloi's line-breaker is calibrated against collision, as TeX's is against the limits of its glue, so in Ooloi the two jobs had to come apart. Which is exactly why LilyPond is so useful to me, even where we do things differently. Another worked example of Hegazy and Gourlay's model in use is invaluable. I'm not ripping LilyPond off, but I am able to benefit from all the research behind it. Where Evenness Gives WayHere are the same two beats at the same width, placed by the new rule. The triplet eighths are 1.730 apart, three times over; the sixteenths 1.557, four times. The bar is exactly as wide as before and the breaker priced it exactly as before; the room is simply spent evenly. At full compression the two rules agree gap for gap, every gap at its minimum. Put precisely, compression now shrinks the spacing without rewriting it: whatever is even at the ideal width stays even as the system tightens, in every stave at once. Whether notes are even at the ideal width is settled earlier, by the long-standing rule that spacing follows the shortest note sounding. The lower stave's triplet quarters sit under the upper stave's quintuplet and sextuplet, and come out 5.6 and 6.0 wide before compression has touched them. From there on, evenness gives way only to ink. The Accidentals checkbox on the example adds six accidentals at five places. In the lower stave's sixteenths, A, A♯, A♮, A, the intervals before the sharp and the natural keep the room their accidentals need, 2.576 and 2.252, and the other two stay even at 1.564. The sharp needs more than a sixteenth's ideal width, so its interval is wider even before any compression, until the system is stretched far enough to release it. Because the staves share columns, the sharp and the natural widen the upper stave's triplet as well: 3.33, 2.70 and 2.40 at the ideal width, where it was 2.40 three times. That's the model doing what an engraver would. The column belongs to both staves, and so does the room the accidental needs. Another stave's notes do the same once they're as close as their ink allows. Below −0.36, the upper stave's sextuplet reaches its minimum inside the lower stave's second triplet quarter and holds it there, while the first quarter goes on shrinking. There's a limit here, and it's a proof rather than a measurement: once staves interleave, every stave evenly spaced and every gap reaching its minimum at exactly the same moment can't both be had. The old rule had the second. I chose the first. At the WorkbenchAll of this happened in a single day, from the drag that showed the fault to the rewritten specifications and the page as it now stands; the change itself took an hour or two. It was made in the model and the ADRs, not in Ooloi's Clojure, which will start from the corrected specification when this stage is built. That's what the workbench is for: the eye judges the spacing before anything is built into Ooloi itself.
The example is on the workbench; that link opens it on its own, at the ratio in the pictures. Drag the gauge further into compression and watch the lower stave's sixteenths stay even. Tick Accidentals to see where evenness gives way, and Raster to see the shared columns that cut one stave's intervals. When the mathematics and the eye disagree about rhythm, it's the mathematics that has to change. On 12 November every barline in Ooloi became a discretionary break, TeX's device from 1981 for a place that looks different depending on whether a line ends there. Variants at a Break described the decision. What I keep coming back to is what it cost, and what it removed. A system's width became a single sum and the gutter disappeared. Hegazy and Gourlay's springs, at the centre of the layout, didn't change at all. Again. That 'again' is what this post is about, and what it says about how notation software has been built. Very Little DataHegazy and Gourlay's springs need remarkably little, and they know nothing about music per se. The mechanism is Hooke's law with a stop, and it would space anything that comes in a row and mustn't overlap. What makes it musical is the data, and the data are what a musician already thinks in: how long each note lasts, which sets each gap's ideal width, and how much room its ink needs, which sets its blocking width. A system that can be specified in those terms can be specified musically, and that has turned out to matter more than I'd realised. Since the middle of October the springs have taken in (a) the crowded first bar of a system; (b) ledger lines meeting accidentals; (c) glyph geometry from the fonts' outlines; (d) the space either side of a barline; (e) flags under compression; (f) rhythmic order among dotted notes; (g) two of Roland Gurt's questions; and (h) discretionary barlines. Each was substantial, and each changed the data. None of them changed the springs. A month ago, in The Seven Thousand Steps, I wrote that every task still to come would come down to giving the one model better input, never to teaching one more formatter about all the others. A month isn't long, and the last section of this post lists what hasn't been tried. But it's no longer only a prediction. What the Springs KeepWhen I adopted the springs in October, I'd have said they were the right way to handle an accidental. That's true, and it's the small version. Building the algorithm has taught me what it does at the deepest level. ADR-0055 states the premise in a sentence: spacing is how a reader sees the rhythm. A player doesn't measure distances. The eye reads the proportions of white between the notes, a long value as an open space and a run of sixteenths as a dense one, across the whole line at once. What Hegazy and Gourlay's springs do, underneath everything else, is distribute rhythm across a page so that those proportions stay consistent to the eye, system after system. When a system is looser than ideal, only the white space stretches, and every white space grows by the same factor, so the ratios the eye reads the hierarchy by are the same at every looseness. That much ADR-0055 decided. What I hadn't seen until recently is why the springs do it so well. Springs come to rest where their stored energy is least, which is school physics. When each gap gives in proportion to its own white space, the least energy is precisely the arrangement in which the white spaces depart least from their ideal proportions, each change measured against the white space it happens to, with no two pieces of ink allowed to touch. For programmers: stretched, the springs minimise the sum of Δ² / (2σs) over the gaps, where Δ is how far a gap has moved from its ideal width, s is its white space and σ is a constant, subject to every gap staying at or above its blocking width. I wanted that checked before I believed it, and on more than three thousand random systems the springs' positions turned out to be exactly that minimum. Seen this way, accidentals and augmentation dots are disturbances of the rhythm: ink that needs room the durations don't account for. A gap held open by a sharp stays at its blocking width while the rest of the line absorbs the difference, shared out over every free gap in proportion to its white space rather than heaped onto the neighbours. And once the system is loose enough, the disturbance vanishes. When every held gap has been caught up, each gap is exactly as wide as it would have been if the sharp had never been there. Dots are subtler, because they're both things at once. The time a dot adds is rhythm, and goes into the ideal width. The ink it adds is a disturbance, and since the workbench caught a sixteenth slipping in above the dots of a double-dotted half, a note's dots count as part of its width. Compression is where I have to be careful with the claim. Squeezed, Ooloi's springs give up room in proportion to what each gap has above its minimum, so long values give up more and the hierarchy flattens. Whether engravers did that, or kept the distances in proportion and squeezed the white around short notes instead, is one of ADR-0055's open questions, and printed plates will settle it. The springs can do either. Under stretching the question is closed. ListeningThe arc is short, and every step of it is in the archive. For two years I dreaded casting off and spacing, and armed myself for a fight with formatters negotiating for room. Last December Knuth and Plass turned casting off into a textbook problem. In October the report Ulrik Bodén tracked down brought Hegazy and Gourlay's springs, and spacing became part of the same problem, consistent and expressible in a way I hadn't thought possible. On 12 November TeX's discretionaries took in the barlines. Twice, Vestigia Nulla Retrorsum, The First Bar of the System and Variants at a Break have the details. Look at the dates of what was adopted: the newest is Hegazy and Gourlay's report of 1987, and the oldest is Hooke's law of 1676. Each time the design moved closer to an algorithm that has been understood for decades, special cases disappeared, from the specification and from the code, the model's and Ooloi's own, and what remained became more general and more powerful. I've stopped regarding this as luck. An algorithm that has been around for decades has had its edges found by other people, and what it needs from its input is written down. Give it that, and you inherit the decades. It also changes what I think my own part is. The springs are Hegazy and Gourlay's, and the search is Knuth and Plass's. What's mine is what surrounds them: a pipeline whose task, here, is to hand the springs data that let a pure algorithm do the work it was designed for, settled before breaking begins and never revised behind its back. Most of it was built for other reasons, before the springs arrived. So a good part of my job turns out to be listening. The algorithm shows what it does with a rule, and if the rule is wrong it shows that too, usually in a case nobody would have thought to test. The animations were where I first heard it: a bar squeezed and let out again, until the model stopped being formulae. The workbench turned that into something closer to a conversation. Where This Is Normal ADR-0057 made the workbench binding. Spacing is now worked out on an exact model before Ooloi builds it: a reference in Python, which computes every spacing figure in the ADRs, and an interactive version in JavaScript, which runs in the browser, held to each other by reference values written as exact fractions that Ooloi's own tests will read too. A stage is ready to be built when its ADR, both implementations and the reference values agree. When I wrote that down, I thought of it as a way of working I'd backed into. Only afterwards did I notice that other fields have worked like this for decades, under other names, and that they're among the most demanding there are. Chip designers simulate the hardware against a reference model until the two agree bit for bit, because a mistake found after manufacture costs a new set of masks. Video coding learned the same lesson the hard way: when an inverse transform specified only to a tolerance let encoders and decoders drift apart, H.264 made it exact. Knuth said he wouldn't believe a program was TeX until he saw it process his torture test, TRIP.TEX, correctly. And TeX does its arithmetic in integers wherever a decision is made, admitting floating point only for setting glue, which, as the source points out, doesn't affect its decisions. Ooloi's rational arithmetic is the same rule applied everywhere. Standards bodies add a discipline of their own, and it's the one where I have to be most careful. The W3C normally wants two independent, interoperable implementations of every feature before a specification goes forward, and independent means that neither shares or derives from the other's code. The workbench's JavaScript was written function for function from the Python. The two catch each other's slips, and 9,632 cases agreeing to the last fraction mean something, but they can't catch a misreading they share. Two earlier models were written from the ADRs alone, one of them by a language model that had never seen the code, and both reproduced the ADRs' results. Over-Engineered? In August last year I wrote a post called Is Ooloi Over-Engineered?. It was about infrastructure: multicore formatting, transactions, GPU rendering, the things that keep a large score usable. The question has come back in a new form, and it's a fair one. I'd expect it from other developers of notation programs as readily as from anyone. Fifty-nine ADRs. An exact model of the spacing in two programming languages, held together by thousands of reference cases. Every spacing figure in the ADRs recomputed whenever a rule changes. A public workbench. All this to space a few bars of music, in a program that hasn't yet drawn a note of its own. I understand how that looks. But over-engineering of the kind that sinks projects is accretion. The Vasa went down in Stockholm harbour on her maiden voyage in 1628 because she carried too much weight above the waterline for the hull beneath her, and in 2003 IEEE Software ran her as a cautionary case for software projects. The last five weeks of Ooloi have gone the other way. The stability term, the stretch dial, a table of glyph pairs, the gutter and a leftover formatting record have all gone, each because something simpler that was already there covered what it had been for. The apparatus is what makes removal safe. When a rule is replaced, the model shows what changes, in every case at once, and when nothing should change, it shows that nothing did. Without that you keep everything, just in case, because nothing can tell you what taking it out would break. That's how accretion starts. Why Heuristics Were the Logical ChoiceSo, some plain speaking, from someone who came across these things on the path, without setting out to find them. My view is that music engraving software has been under-engineered, and for reasons that have nothing to do with the ability of the people who wrote it. Most of it was written by very competent engineers, as I said in Music for Computer Scientists. The reasons are structural. What follows is my reading rather than a finding about any particular program, and I count four.
The algorithms were never secret. Hegazy and Gourlay published in 1987. What was missing from the field was a surrounding architecture that settles every width before breaking begins. What Hasn't Been Thrown at It Yet If the pattern holds, the consequences for the work ahead are large, and mostly quiet. The horizontal work that remains stops being a question of algorithms and becomes a question of values, measured from printed plates, the duration table first among them. Every new kind of notation arrives with a single question, which of the four forms it takes, and the answer has one place to go. Work of that shape can be listed and counted. (And the importance of this for plugin developers adding new graphics can't be overstated.)
But what the springs haven't met yet makes a long list, and it should be given: full scores, several voices on one staff, key signatures, grace notes, bar rests, and, outside the model altogether, slurs, most ties and page turns. Any of these could be the first thing that doesn't fit, and ADR-0055 already says what happens then: the design changes upstream, and no pass is added after the springs. We shall see whether the pattern continues. It does seem that it will. But expecting isn't knowing, and the springs will have the last word. I'll keep listening. A new ADR: 0058, Variants at a Break. It began with a small question: should the space inside a system's preamble, between clef and key signature, be a spring like the space between notes? It shouldn't. Look at any engraved page and the preambles stand one above another, the same glyphs in the same places, system after system. The eye reads them as part of the frame. Squeeze one and the column breaks. So the blocks are rigid, and only the approach from the key signature to the first note gives way. Following that thread changed more than I expected. Every barline is now what TeX calls a discretionary break: three small records, for when no break falls there, when a system ends there, and when one starts there. A system is simply its start, its measures, the barlines inside it and its end, added up. The gutter is gone, its contents sent where they belong. The preamble comes from a table, so identical preambles are identical by construction. And the breaker stays exact. None of the parts is new. Knuth and Plass had the three forms in 1981. But TeX's discretionaries may not contain glue. Ours contain springs. And as a result, the workbench will need to learn how to draw key signatures. I'll start with C♯ major, and the reason is – Ondine… The first pictures of Ooloi's spacing were stills. A still shows where everything ends up and nothing of how it got there. The animations changed that, and more than I'd expected. Watching a bar squeezed and let out again, I could see what Hegazy and Gourlay's model really is and how it behaves. Spacing stopped being a set of formulae and came alive. Then there was the response. We were suddenly discussing music. That's when I realised I had a research tool on my hands, and one I could put straight into other people's. So there's a workbench now: a fully interactive model that runs the core of Ooloi's horizontal spacing, as the ADRs specify it, on a few bars of music, redrawing them as the settings move. It’s on the site now, under Workbench, and the video above shows it at work. I'd put it on a par with making the Librarian public. The Librarian lets anyone search the reasoning behind Ooloi's architecture; the workbench lets anyone see what its spacing does, try a rule and judge it by eye before a line of Clojure exists. It's a way of working I hadn’t planned, and one that follows directly from how Ooloi is built. What It ShowsAcross the top are the settings, each with a line saying what it does. Below them a gauge runs from compressed to stretched; drag its pointer and the whole passage follows. Under the staff are the springs, rust where a gap is held as close as its ink allows and grey where it's free, so you can see what's holding and what's giving way. The model recomputes and redraws in well under a millisecond, faster than the screen refreshes, so the music follows the hand. Nothing in it is rendered by Ooloi itself. You can choose among the ten SMuFL fonts Ooloi ships with. No rule in the model knows what a sharp or a flag is, so every font gets the same rules, and when you change the font the spacing follows the new ink, with nothing tuned for any of them. Four of the ten are handwritten jazz fonts, which makes that a harder test than it sounds. Among the DotsHere's the kind of thing it's for. In a bar with a double-dotted half note and two sixteenths, I was dragging the line from loose to tight and back, and somewhere on the way in the first sixteenth slid in above the dots of the half note: being higher, it touched nothing, so nothing held it back. The springs were doing exactly what they'd been told, and no test would have caught it. It still read wrong: a note standing inside the time of the note before it. The accidentals were tucking into the dotted note's space too, and that looked right. So the rule became this: a note keeps its distance from the right-hand side of the previous notehead, dots included, while its accidental may still tuck in. For a while a checkbox let me compare the two. The answer was always the same, so the checkbox went, the ADRs were amended and every figure in them was regenerated. Below is the same bar under both rules, dragged from tight to loose: It took a slider to see it, and then it was obvious at once. An animation runs past the moment at its own pace; a slider lets me stop on it and cross it again and again. Ooloi has no spacing code yet, which makes this the cheapest a mistake in it will ever be. The new rule will reach that code already decided, with the numbers it has to produce. Why It Can ExistFor what it covers, the workbench computes what Ooloi's spacing computes, in the same stages and to the same exact fractions, and Ooloi's own code will be held to its numbers. That's possible only because the spacing is small enough to copy. Every rule reaches the springs in one of four forms before the line is broken, and the pipeline runs one way, so nothing comes back afterwards to correct anything and each stage can be reproduced from its inputs alone. The arithmetic is exact, so the workbench and Ooloi can be compared for equality rather than within a tolerance. When a rule changes, the ADRs, the figures and the workbench change with it. The workbench will never run the whole formatting pipeline, and isn't meant to: it holds whichever parts of the spacing I'm working on, for exploring the mathematics until each rule is right, so that the herd of cats never gets in. Where layout emerges from formatters correcting each other's work, there's no small model to take out and try things on. The behaviour lives in the corrections, and the only way to learn what a new rule does is to build it into the whole program and see what the rest of it makes of the change. The new ADR-0057: Reference Model of the Spacing Pipeline makes this way of working binding. JudgementOoloi's spacing has a motto: Hegazy and Gourlay provide the physics, I provide the dials, and the user provides the artistic judgement. Until now the third part had to wait for Ooloi to exist. It doesn't any more.
Engravers can see at once where the page looks wrong and find out whether the house look they need is within easy reach of the dials, without reading a line of an ADR. And I get to see the consequences of my mathematical choices. Where every eye gives the same answer, there's a rule, as there was with the dots. ADR-0055 says that the first note of a measure stands one staff space from the barline, measured to whatever ink comes first. It's a reasonable rule, and the kind you only really understand by looking at it. So I looked. This week has been play, in the most serious sense I know: change a number, watch what the page does, change another. The stretch dial was already settled at 1, so that only white space stretches, which is what an engraver does. What I wanted now were sensible defaults for everything around a barline: the space after it, the space before it, and how both behave when a system is squeezed or pulled. Defaults defensible today, as legible as the mathematics allows, and still only defaults, since a house style can replace any of them. What follows are four pictures, in the order I made them, each answering a question the one before had raised. They're computed by Ooloi's reference model, not rendered by Ooloi. Bravura's glyphs are drawn from the font's outlines and every contact is measured on them; the rest are placeholders until the plates have spoken. The music above is where it ended: four measures at the default settings, with nothing annotated. Everything below is how it got there. One Rule, Six NotesHere's the first column after a barline, six ways: a plain note, a sharp, a flat, a natural, two stacked accidentals and an arpeggio, at normal width and fully compressed. The sliders are the settings. Wherever a distance is drawn in a slider's colour, that setting is what put it there; grey is a result. The trouble with the rule as written doesn't need a picture. One staff space to the first ink means that a sharp pushes its notehead 1.2 spaces further to the right than a plain note, and two stacked accidentals push it 2.1. Engravers don't do that. They let an accidental come closer to the barline than a notehead would, because the notehead is the rhythm and the accidental only announces it. So the rule split in two. The standard distance, 1.0, runs from the barline to the notehead. A second setting, the least distance at normal width, lets any ink before the notehead come as close as half a space before it starts pushing. A third, the least distance at full compression, is where all of it ends up when a system is squeezed as far as it will go: a quarter space, approached in proportion on the way. Now look at the bottom row. The sharp, the stacked pair and the arpeggio come in to a quarter space. The flat, the natural and the plain note stop at half a space, and nobody told them to. A flat's upright, a natural's and a stem pointing down all run parallel to the barline, and two parallel lines closer than Bravura's double barline, whose lines are 0.4 apart, read as a double barline. That's the fourth setting, the least distance to a stroke, and it doesn't know what a flat is. It looks at the outline: where the edge facing the barline runs straight and parallel to it for at least a staff space, that edge is a stroke. A sharp's uprights are short and set back behind its crossbars, so a sharp isn't one. Forty StavesThe first column belongs to every staff in the system. If one staff's note has to move, the whole column moves with it, in every staff. That's why the least distance at normal width matters more than it first seems to. In a score of forty staves, a single accidental in a single staff shouldn't push forty first notes to the right by its full width. An engraver would let that accidental sit closer to the barline than the standard distance and keep the column where it was. With the defaults, the sharp moves the column 0.70 rather than 1.20. Set the least distance at normal width to a quarter space, as the third panel does, and it moves 0.45. The upper row stands still at normal width. The lower row runs through one adjustment ratio shared by all three panels, from fully compressed to as loose as TeX would tolerate, and the space after the barline shrinks in proportion as the stacks compress, like every other gap. Each panel ends in a double barline, so you can compare a stem beside a barline with the real thing. Room to SpareWhen a system stretches, every note's white space grows in the same proportion. The question is what the space after the barline should do meanwhile. The fifth setting answers it: the share of the standard distance that stretches as white space does. At 0 the space after the barline stays put however loose the line gets; at 1 it keeps its proportion to every note's white. The three rows are identical down to normal width and only part company as the system loosens. The default is a half, and it's also LilyPond's. Its barline gives the next note a semi-fixed space of 0.9, half of it fixed and half stretchable, and in this model that comes to exactly the same thing. The difference is that LilyPond chooses between a few fixed kinds of space (rigid, half, all), whereas here it's a number between 0 and 1. The Other SideSo far everything has happened after the barline. Before it the music is different: flags, dots, and the last note of a measure, whose space runs right up to the barline, which belongs to its measure, thickness and all. My first version gave this side a least distance of its own, a quarter space at every ratio. It left an eighth's flag 0.28 from the barline at normal width and a sixteenth's 0.25, and it looked cramped. The cure turned out to be no new setting at all. A least distance keeps ink legible beside a vertical line, and that has nothing to do with which side the ink is on, so the barline's own pair, half a space at normal width and a quarter at full compression, now guards both its sides. The stroke distance does too, which is why the up-stemmed quarter at the end of the first measure keeps its half space when everything else is squeezed. The one setting that belongs to this side alone is the borrowing: how much of the barline and the space after it is taken out of the last note's own space. At 0, the default, the barline comes on top, as it does in LilyPond. At 1, the next measure's first note stands exactly where the last note's space ends, so the rhythm runs on across the barline as if it weren't there, at normal width and stretched alike. Watch the quarter at the end of the first measure: underneath, the barline adds 1.16, then 0.58, then nothing. The eighth and the sixteenth have nothing to lend. Their flags need the room: a sixteenth gets 1.8 spaces, and its flag reaches 2.18 from the left edge of its notehead, so the barline makes way for it even at normal width. And then there's the thing I keep going back to watch. At full compression, the two sixteenths in the third measure slide together until the first one's flag is a clearance away from the second one's stem, the two flags nesting one above the other. Nothing in the model knows what a flag is. The outlines of two notes, compared band by band, are all it has. No Cats Were HerdedNone of this needed a rule about anything in particular. There's no rule for a flat after a barline, none for a flag before one, and none to decide which rule wins when two of them meet. Every collision is the same comparison: two outlines, band by band, kept apart by a clearance. The settings say how far; the springs say where, and they're the same Hegazy and Gourlay springs that cast off the music. Had I described spacing as rules about pairs of things, I'd be herding cats: a rule for a flat after a barline, another for a natural, another for a stem, exceptions to each, a referee for their quarrels, and a new cat for every new symbol. The springs and the outlines are what made the cats unnecessary, and I chose both for other reasons entirely, the springs for casting off and the outlines for a ledger line between a sharp's crossbars. Watching them pay out here, without being asked, is the best part of the week. It's also why this week was possible at all. I could look for defaults by playing because the mathematics is pure: each setting does one job, so I could move one, look, and know that nothing else had shifted in some negotiation behind my back. And the model is exact. It's written from the ADRs in rational arithmetic, it reproduces their published numbers, and Ooloi's implementation will be checked against it number for number, so what these pictures show is what Ooloi will do with the same values, and any difference will be a bug. With a herd of cats I could have done neither. The defaults would have had to wait for the rendering pipeline, and then be found by arguing with it. I want to be exact about the claim, though. The stroke distance is an optical rule rather than a matter of collision; it's simply stated geometrically, so that it applies to any straight edge. And there will be heuristics in Ooloi, because engraving is full of rules of thumb. One is already waiting: an up-stem just before a barline looks cramped, and LilyPond adds a little space for it. But rules of thumb will come where they cause no damage and no delay, on top of a model that already guarantees that nothing collides and every note stands where its duration puts it, never in place of it. À la recherche des défauts perdusSo, for now: one staff space from the barline to the notehead; half a space to any ink at normal width and a quarter at full compression, on both sides of the barline; half a space to any stroke, always; the space after the barline stretching at half the rate of white space; and nothing borrowed from the last note. Each is a single number in a house style, and none needs another adjusted to it. The relevant ADRs have been updated with the new settings, their defaults and the pictures you see here, ADR-0055, Horizontal Spacing, first among them. Anyone who objects to the bottom rows of these pictures will be objecting to full compression, which is the limit the settings are defined at, not what a score will normally look like. A system that tight costs the line breaker more than a hundred times as much as one at its ideal width, so it adds a system long before it gets there. You'll see it where breaks are forced, or in a short passage between forced breaks with slightly too much music for one system and too little for two. And if a quarter space is still too tight for your taste, raise it: the breaker will simply add systems sooner. Not everything came out clean. Compared band by band, two noteheads a second apart in successive columns were allowed to overlap a little in width, because their outlines curve away from each other and the ink never quite meets. Engravers don't let a note begin before the previous one has ended, so a rule about the order of columns is coming: a rule of rhythm, which outlines were never meant to know about. A dot at the end of a heavily compressed measure can also come close enough to a barline to look like half a repeat sign. Both will get their turn. Exeunt, pursued by a stave
Cutting Corners Is Not Enough argued that spacing should follow the ink itself, not boxes around it. Taken to its conclusion, that applies to the ledger lines as well. So I recomputed them from Bravura's outlines, read straight from the font file, with everything else as in the animations since Ut Tensio, Sic Vis. This is what happens. Here's a bar of chromatic sixteenths, dragged from its tightest to loose and back. Watch the panel on the right. At the tight end, ledger lines come in from both sides of the sharp, between its crossbars, and each one stops just short of the ink. The sharp stays tight to its notehead, and its lines lose only what the ink itself takes from them. Even at the tightest, nothing collides. Incidentally, that's exactly what Magnus asked for under Dials: stave 4's sharp, tight to its notehead, without C♯6's ledger lines cut short. With the real shapes, a line simply runs on until it meets ink. The second animation mixes sharps, flats and naturals. Each has a shape of its own, and all three are handled the same way, without a rule for any of them. Ledger line shortening occurs naturally regardless of the accidental, and on both sides of it. As before, these are reference models, not Ooloi's output. The outlines and Bravura's engraving metrics are real; the clearances and the opening width are placeholders.
And for anyone joining this thread late: every one of these values is a setting you can change. This closes an arc that began with Ut Tensio, Sic Vis less than a fortnight ago, and it settles how Hegazy and Gourlay belong in Ooloi. Their springs decide where the notes go, and they never had to learn what a ledger line is. Everything about ledger lines happens at either end of the pipeline: Stage 1 works out how short each line may become against the accidentals' real shapes, and Stage 5 lengthens it again into whatever room the springs have given. The 1987 model stays exactly as it was. The six stages around it do the rest. In the comments to Ut Tensio, Sic Vis I told Magnus Johansson that Hegazy and Gourlay provide the physics, I provide the dials, and the user provides the artistic judgement. I meant it as a summary, but it also is a work plan. The physics has had several posts of its own. This one is about a few of the dials: what they are, what each is called, what kind of control it is, and what it does to the page. Two animations show them at work. The first is about what takes the room when a system is looser than its notes need. The second answers the question Magnus asked in those comments, which NOTATIO took up almost at once: who gives way when an accidental meets a ledger line? Who Takes the RoomWhen a system has more room than its notes need, something has to take it. Which notes take it is decided by a single setting, the stretch dial: a slider from 0 to 100%, shown in the animation at three positions, labelled λ = 0, 0.5 and 1. At 0, the whole distance from one note to the next stretches. Every gap grows in proportion to its ideal width, so a loose system is simply the ideal one, scaled. At 100%, only the air stretches: the white space left over once the noteheads have taken theirs. The half note then takes most of the room, and the sixteenths stay together. That end of the slider is LilyPond’s behaviour. At 50% the two share it, and the slider can stop anywhere along the way. Where its default belongs is for the plates to say, not me. Watch three moments. While the bar is compressed, all three rows are identical, because the dial only acts when there’s room to spare. At r = 0, the ideal spacing, they’re still identical, with the gaps before the sharps held open at exactly the width the sharps need. Then the barline moves out, and the rows go their separate ways. The gauges show the adjustment ratio, r, the number the line breaker judges each system by. At −1 the music is as tight as it can go; at 0 it's ideal; the green band is the looseness the breaker accepts. All three gauges agree at every width, and that's deliberate: the breaker judges a system by how much room it has to spare, not by which notes take it. So the dial never changes its verdict. It decides where the room goes and nothing else, which means it can't move a line break, and turning it never obliges you to adjust anything else to keep the casting off sound. Note that in practice, r is as close to 0.0 as possible: that's the entire purpose of casting off. Values for r near -1 are very extreme and rarely or never appear, unless you force it explicitly. So keep in mind that an r of -1 results in the music having lost all rhythmic proportionality. But – with Hegazy-Gourlay's algorithm, you still get no horizontal collisions. Who Gives WayMagnus asked whether the C♯4 and A♯5 in the ‘Ut Tensio’ examples could keep ledger lines of normal length when there’s room to the left of the accidental. They can. Three settings decide who gives way, the ledger line or the accidental:
One difference between them matters more than any other. The minimum protrusion decides how much room the notes reserve, so it’s the only one of the three that moves notes. The other two only spend room the spacing has already given. They never move a note, and they never move a line break. (The image below is very large and is reduced in size to fit. Click on it to open it in a new window where it can be zoomed.) Each stave changes one setting from the stave above, and the changed value is highlighted. Stave 1 never shortens its ledger lines. Magnus, you once said that shortened ledger lines weren’t always necessary as far as you were concerned. This is that setting, and it has a price. At the tight end the bar doesn’t fit, and the sharps end up nearer the previous note than their own. They turn rust when that happens. Stave 2 lets the lines shorten to 0.16 stave spaces, so the bar fits. But as room appears, the sharps move out past the lengthening lines and drift towards the previous note. Stave 3 switches on setting 3. The lines give way instead, and the sharps stay where they belong. They turn blue while the setting holds them. Stave 4 keeps every sharp tight to its notehead and cuts the ledger lines around it. Given room to spare, the first three staves agree. The fourth keeps its own look. Beside each stave, a panel magnifies one gap, C6 to C♯6. The note’s own notehead stays put, so you can watch the sharp travel, and the distances to both noteheads change as it does. In stave 4 the panel shows something else as well. Bravura’s sharp has open corners, and the lower ledger line reaches into one of them, further under the sharp than the line beside the notehead. Nobody had to write a rule for that: the sharp’s outline, band by band, is all the springs need. The ledger lines don’t only give way to accidentals. Look at C6 in the panels when the bar is at its tightest: its lower ledger line is shorter on the left than the one above it. B5 has a ledger line at the same height, and the two share the space between them, keeping a sliver of air in the middle; the line above has no neighbour at its height and only has to clear B5’s notehead. There’s no special rule here. The lines reserve only their shortest acceptable form, so they never push the notes apart, and the notes stay where their durations put them. If you’d rather the lines kept their full length and the notes moved apart instead, that’s the minimum protrusion on the other side, set to the full extension. So these three aren’t the whole story. Whether a note’s ledger lines should be evened out, so that the lower one is never shorter than the one above, is a matter of taste, and so is shortening both ends of a line symmetrically, which someone on NOTATIO suggested. Both are candidates for dials of their own, and both will get their turn. Division of LabourA word on what you’re looking at. Both animations are conceptual. Positions are computed from the published specifications and drawn from a real music font, but nothing in either was rendered by Ooloi. Bravura’s metrics are real; every other value is a placeholder until the plates have spoken. What they do show is the division of labour. The springs guarantee that notes stay where their durations put them and that nothing collides. Within that guarantee, the dials decide how the page looks, each doing a single job, none needing to know about the others. Which positions are right is the engraver’s call, as it always was. Both animations are free to use. Download them, put them in a lecture, a forum post, a book or a presentation, cut them up or build on them; no permission is needed. Formally, they’re released under CC0.
|
AuthorPeter Bengtson – SearchArchives
November 2026
Categories
All
|
|
|
Ooloi is an open-source desktop music notation system for musicians who need stable, precise engraving and the freedom to notate complex music without workarounds. Scores and parts are handled consistently, remain responsive at scale, and support collaborative work without semantic compromise. They are not tied to proprietary formats or licensing.
Ooloi is currently under development. No release date has been announced.
|

RSS Feed