Menu

#5413 X-aligning problem with chords containing unisons

Fixed
Enhancement
2018-09-16
2018-09-05
No

http://codereview.appspot.com/369840043

Reported by Torsten Hämmerle:

Chords containing unison highest/lowest notes will sometimes produce wrong
positioning of articulation marks, dynamics, slurs, etc.
These grobs should be centred on the notehead that is on the correct side of
the stem (as Gould put it).

Technically, the "correct" side of the stem is determined by the first note
in the chord, i.e. the note opposite the stem's direction.

If this extremal note happens to have a unison sibling, LilyPond currently
will pick the wrong notehead in some cases (stem up), thus causing a wrong
positioning of articulations, dynamics, slurs, … The spacing will be
widened up a bit, too, as a chord-building side-effect.

The misplaced grobs are coloured in red and below, there's my proposed
solution for correct positioning.

1 Attachments

Discussion

  • Torsten Hämmerle

    issue 5413: X-aligning problem with chords containing unisons

    Changes to be committed:

    modified: ../lily/stem.cc Stem::extremal_heads
    - To avoid confusion, process noteheads in <> from left to right
    - lowest note: return FIRST unison note (punctum saliens!)
    - highest note: return LAST unison note
    Separate DOWN/UP processing now (because of < vs. >=).
    Result: consistent spacing plus correct first/last/main notehead detection.

    new file: ../input/regression/chord-X-align-on-main-noteheads.ly
    - Regression test added

    http://codereview.appspot.com/369840043

     
  • Torsten Hämmerle

    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,3 +1,5 @@
    +http://codereview.appspot.com/369840043
    +
     [Reported by Torsten Hämmerle:](https://lists.gnu.org/archive/html/bug-lilypond/2018-09/msg00000.html)
    
     Chords containing unison highest/lowest notes will sometimes produce wrong
    
    • assigned_to: Torsten Hämmerle
    • Needs: -->
    • Type: -->
     
  • Torsten Hämmerle

    The reason for misalignment and spacing issues was a slight inaccuracy in
    lily/stem.cc, function Stem::extremal_heads

    This function is supposed to give back "lowest" and "highest" head of a chord.
    Especially the note opposite the stem direction is used to determine the main column resp. the "correct" side of the stem when there are unisons or seconds in a chord and noteheads have to be displaced/shifted.

    In the special case of unisons (i. e. notes of the same pitch) at the lower/upper end of a chord, Stem::extremal_heads did not give back the first of the lower unison notes, but the last.
    This could lead to an X-aligning of grobs to the wrong notehead and it also messed up spacing.

    Please find attached a comparative regtest showing the new chord-X-align-on-main-noteheads regtest file and two exiting tests showing the more natural spacing after the patch.

    All the best,
    Torsten

     
  • Anonymous

    Anonymous - 2018-09-06

    Passes make, make check and a full make doc. Reg test diff attached.

     
  • Anonymous

    Anonymous - 2018-09-06
    • Patch: new --> review
    • Type: --> Enhancement
     
  • Anonymous

    Anonymous - 2018-09-10
    • Patch: review --> countdown
     
  • Anonymous

    Anonymous - 2018-09-10

    Patch on countdown for Sept 13th

     
  • Anonymous

    Anonymous - 2018-09-13
    • Patch: countdown --> push
     
  • Anonymous

    Anonymous - 2018-09-13

    Patch counted down - please push

     
  • Anonymous

    Anonymous - 2018-09-16
    • labels: --> Fixed_2_21_0
    • status: Started --> Fixed
    • Patch: push -->
     
  • Anonymous

    Anonymous - 2018-09-16
    author  Torsten Hämmerle <torsten.haemmerle@web.de> 
        Sun, 2 Sep 2018 09:25:51 +0100 (10:25 +0200)
    committer   James Lowe <pkx166h@runbox.com> 
        Sun, 16 Sep 2018 15:14:33 +0100 (15:14 +0100)
    commit  c368400757fabe147c2f237051a71d60a6465e5b
    

    Thank you Torsten.