lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Aligning note to different voice across staves


From: Carl Sorensen
Subject: Re: Aligning note to different voice across staves
Date: Tue, 2 Feb 2021 18:50:52 +0000
User-agent: Microsoft-MacOutlook/10.10.1b.201012


´╗┐On 2/2/21, 11:28 AM, "lilypond-user on behalf of Thibaut Horel" 
<lilypond-user-bounces+carl.d.sorensen=gmail.com@gnu.org on behalf of 
thibaut.horel@gmail.com> wrote:

    When trying to typeset the attached bit of music (this is bar 18 of the 
    Fugue in BWV 881), I encountered a problem captured by the following 
    minimal example:
    
    ------
    \version "2.22.0"
    \new PianoStaff <<
        \new Staff << \relative{e'16 f g e} \\ d'4 >>
        \new Staff { \clef bass e8[ g] }
      >>
    ------
    
    In this example, I would like the e8 in the lower staff to be aligned 
    with the d4 in the upper staff. However, because of a note head 
    collision, the d4 in the upper staff is shifted to the right, and the e8 
    from the lower staff is instead aligned with the e16 in the upper staff.
    
    I was able to obtain the correct behavior by adding \once\override 
    NoteColumn.X-offset = 1.25 before the e8 in the lower staff. But there 
    are two things I don't like about this solution:
    
    1. if I understand correctly, X-offset is measured in staff-space, so I 
    am worried this might not scale properly when changing the note head 
    size (for example by using a different font). It would be nicer to be 
    able to express the offset in note head width, as for the force-hshift 
    property for example.
    
    2. My solution requires trial and error to find the correct value for 
    the X-offset, whereas what I am trying to achieve can be expressed 
    easily at the semantic level: I would like the e8 in the lower staff to 
    be considered part of the second voice of the upper staff for vertical 
    alignment purposes (in particular it should be shifted at the same time 
    in case of a collision).
    
    Is there a better way to achieve what I am trying to do? Any insight 
    into this problem would be greatly appreciated.

Here's a workaround that uses a hidden note.  I think it might be better if 
LilyPond did this automatically, but I'm not sure.

\version "2.22.0"
\new PianoStaff <<
    \new Staff {<< \relative{ e'16 f g e} \\ { \voiceTwo d'4} >>}
    \new Staff { \clef bass <<{\hideNotes f16} \\ {e8[ g] } >> }
  >>

    
    Thanks,
    Thibaut
    
    


reply via email to

[Prev in Thread] Current Thread [Next in Thread]