Loading…
Loading…
Rule
Gradus GE-051 · cite this code — it is permanent. Rule id beam-group-stem-direction-average-vs-extreme-note
The classic engraving rule (per Gould/Read) is that a beamed group's stem direction is set by whichever note is farthest from the middle staff line — an extreme-note rule. VexFlow's actual implementation instead sums `(line - 3)` across every note (and every chord pitch) in the group and takes the sign of the total — an averaging rule. These two methods can disagree.
A beamed group has one note well above the staff's middle line and three notes clustered just below it: Gould's rule (farthest note governs) would set stems UP; VexFlow's summed average, dominated by the three close-but-below notes, may compute DOWN.
Gould, Behind Bars, ch. Stems — stem direction of a beamed group governed by the note farthest from the middle line; contrast with VexFlow's `calculateStemDirection` (`beam.ts` lines 16-30): `lineSum += keyProp.line - 3` for every note/chord-pitch, returning `Stem.DOWN` if `lineSum >= 0` else `Stem.UP`.
AUTHORITY DISAGREEMENT: recommend Gradus adopt Gould's extreme-note rule as the reference standard for audit purposes (more widely cited across Read and Ross as well), while accepting VexFlow's averaging as the actual rendered behavior — any divergence should be reported as an advisory note about a subtle deviation from best practice, not a hard rendering bug.
Our own judgement, not a sourced convention — shown separately so the two are never confused.
This rule can be decided from pitches, durations and voices — no layout required. A validator can check it before anything is drawn.
Gradus GE-051 — VexFlow determines a beamed group's stem direction by summed average line position, not by the single note farthest from the middle line. Gradus Engraving Rulebook v1.0. https://gradusmusic.com/engraving/rule/beam-group-stem-direction-average-vs-extreme-note
Rulebook v1.0 · text licensed CC-BY-4.0 · machine-readable at /api/v1/engraving/rules/beam-group-stem-direction-average-vs-extreme-note