lilypond-user
[Top][All Lists]
Advanced

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

Re: Fwd: Note head on barline


From: Jean Abou Samra
Subject: Re: Fwd: Note head on barline
Date: Wed, 22 Feb 2023 15:49:48 +0100
User-agent: Evolution 3.46.4 (3.46.4-1.fc37)

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

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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