Skip to content

TypeError in ScoreChordNoteHeadInfo._canShareNoteHead with three voices (unison plus a second) #2893

Description

@Geoff-Walker

Version: 1.8.3 (from reading the source, the same code is on develop)

Summary

The renderer throws TypeError: Cannot read properties of undefined (reading 'length') in ScoreChordNoteHeadInfo._canShareNoteHead (called from _checkForGroupDisplacement) when three voices sound together on one staff, two of them in unison and the third a second away.

Minimal repro (alphaTex)

\track "P"
\staff {score} \tuning piano \clef G2 \ts (1 4)
\voice
:4 c5 |
\voice
:4 b4 |
\voice
:4 c5 |

Rendering with ScoreRenderer (SVG engine) at width 300 throws.

What seems to happen

Voices 2 and 3 form one stem-down group containing a second (B4 and C5), so C5 is moved into displacedNotes. The group's minimum step still accounts for it, but _canShareNoteHead looks up the bottom step in correctNotes only, gets undefined, and reads .length. A possible fix is to look in displacedNotes as well, or to return false when the lookup finds nothing.

The input is real engraving: Dvořák, Rêverie, bar 40, which has three voices on the upper staff.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    Priority

    None yet

    Area

    None yet

    Platform

    None yet

    Work State

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions