lilypond-user
[Top][All Lists]
Advanced

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

Re: Problem with cross-staff colliding notes


From: Thomas Morley
Subject: Re: Problem with cross-staff colliding notes
Date: Thu, 27 Aug 2020 22:52:30 +0200

Am Mi., 26. Aug. 2020 um 20:42 Uhr schrieb Claire Meyer
<claire.meyer.bourhis.lilypond@gmail.com>:
>
> Hi,
>
> I'm trying to reproduce a piano score that has a lot of cross-staff notes, 
> some of them colliding. There are 3 voices :
> - one for the right hand on the upper staff,
> - one for the left hand on the lower staff,
> - and for the left hand on the upper staff.
> That last voice is the cross-staffed one. Because the right hand overlaps a 
> bit with the left, some collisions happen because the overlapping notes are 
> written on the same staff.
>
> In the snippet that I'm sharing, there are two problematic bars :
> - on the first bar, I "solved" the problem (the pair of Fs). I tried looking 
> at lilypond examples to see for something matching, found something, applied 
> it and it worked, but I have no idea why (and I'd be grateful for an 
> explanation).
> - then for the second bar, there are two pairs of F, and I'd like the same 
> thing as for the first bar, but have not been successful in any attempt to do 
> so (admittedly because I didn't understand how I solved my problem the first 
> time around).
> - in the snippet that I provide, I also seem to have a weird treble clef, and 
> I don't why. I don't have it in my full score, it happened when I trimmed my 
> score to provide the snippet, so it's not a big deal to me, but if someone 
> can explain, I'm grateful too.
>
> The snippet is on lilybin : http://lilybin.com/7w0cet/2
>
> Thanks to anyone who can help!
> Claire
>

Hi Claire,

I don't understand what you mean with "colliding" notes.
Look at the output of below.
Equal notes in different Voices will be merged per default (first
case), unless it would lead to difficulties to distinguish durations,
thus in the second case they don't merge.
You can override default-behaviour, see the third case.

\new Staff
  <<
    \new Voice {
      \voiceOne
      b4 s b4 s
      b4 s2.
    }

    \new Voice {
      \voiceTwo
      b4 s b2
      \override NoteColumn.force-hshift = #1
      b4 s2.
    }
  >>

That said, what do you want?
- Always merging? Don't do so, see above
- Always two NoteHeads? Use the override as shown.

Though, I'd be fine with merging or not merging NoteHeads as of
LilyPond's default. But that's only me.

#####

To facilitate adjusting NoteColumns for cross-staff stems I once wrote pushNC

Use it instead of that adding of invisible Notes

pushNC =
\once \override NoteColumn.X-offset =
  #(lambda (grob)
    (let* ((p-c (ly:grob-parent grob X))
           (p-c-elts (ly:grob-object p-c 'elements))
           (stems
             (if (ly:grob-array? p-c-elts)
                 (filter
                   (lambda (elt)(grob::has-interface elt 'stem-interface))
                   (ly:grob-array->list p-c-elts))
                 #f))
           (stems-x-exts
             (if stems
                 (map
                   (lambda (stem)
                     (ly:grob-extent
                       stem
                       (ly:grob-common-refpoint grob stem X)
                       X))
                   stems)
                 '()))
           (sane-ext
             (filter interval-sane? stems-x-exts))
           (cars (map car sane-ext)))
    (if (pair? cars)
        (abs (- (apply max cars)  (apply min cars)))
        0)))

lowerv = \relative c' {
    \grace s8
    \stemDown
    r4
    \pushNC aes2
    aes4
    r4 aes4 aes2
}

Cheers,
  Harm



reply via email to

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