lilypond-user
[Top][All Lists]
Advanced

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

Re: Note head on barline


From: Immanuel Asmus
Subject: Re: Note head on barline
Date: Wed, 22 Feb 2023 17:06:50 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0

Thank you, this works like a charm, even with tuplets, multiple voices or staves (as far as I tested).
There is one case that doesn’t work as expected, but I do not (yet) need it: Namely, when the note on the barline is dotted, the dot will not be moved. Try, e.g.,

\fixed c' { \time 3/4 d4 g2. fis8 g a4 }

instead of the original melody, and you see what I mean.

Regards,
Immanuel

Am 22.02.2023 um 15:49 schrieb Jean Abou Samra:

Le mercredi 22 février 2023 à 15:05 +0100, Immanuel Asmus a écrit :

 Dear all,            I want to typeset the sincopa as it was customary between 1500         and 1700 AD: A note whose duration would exceed the bar should         be placed directly on the barline. (Attached is a scan from a         1739 edition of one of Geminiani’s sonatas.)  
    Some years ago, I found a snippet that dealt exactly with this         problem and used some excessive scheme coding, so I know it must         be possible. However, I’m unable to relocate this snippet.  
  Any help would be appreciated.  

For me, this works:

\version "2.25.3"

#(define (Heads_on_bar_lines_engraver context)
   (let ((busy #f))
     (make-engraver
      ((process-music engraver)
       (let ((current (ly:context-current-moment context)))
         (set! busy (filter-map
                     (match-lambda
                      ((end . grob)
                       (and (not (equal? end current))
                            grob)))
                     (ly:context-property context 'busyGrobs '())))))
      ((stop-translation-timestep engraver)
       (let ((bar (ly:context-property context 'currentBarLine #f)))
         (when (and bar (pair? busy))
           (let ((col (ly:grob-parent (car busy) X))
                 (group (ly:grob-parent bar X)))
             (ly:grob-set-parent! col X group)
             (ly:grob-translate-axis! col -0.6 X))))))))

\layout {
  \context {
    \Voice
    \consists #Heads_on_bar_lines_engraver
  }
}

\fixed c' {
  \time 3/4
  r4 d g2 fis8( g) a4 r g b2 a8( b) c'4
  r b d' g c'( ees')
}

I am actually pretty surprised that it works, because I would have expected turning note columns into non-musical grobs to wreck all assumptions of the layout engine, but, well, at least on this example, it works. I would not count on it to be super reliable, though.

Best,

Jean


reply via email to

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