lilypond-user
[Top][All Lists]
Advanced

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

Re: Extend all hairpins over time signature changes


From: Aaron Hill
Subject: Re: Extend all hairpins over time signature changes
Date: Mon, 01 Mar 2021 15:30:59 -0800
User-agent: Roundcube Webmail/1.4.9

On 2021-03-01 2:39 pm, N Trocado wrote:
Thank you for your answer.
I do use /once when appropriate, and defining a variable indeed helps
with the typing.
But I was hoping for a way of establishing that all hairpins that
cross time signature changes extend beyond the barline, and if
lilypond took care of this automatically it would be one less thing
for me to worry about 🙂.

So it just the case that you want hairpins to extend over time signatures? A custom engraver could automate that:

%%%%
\version "2.22.0"

extendHairpinsAcrossTimeSignature =
#(lambda (context)
  (let ((hairpins '()))
   (define (extend-hairpin grob)
    (ly:grob-set-property! grob 'to-barline #f))
   (define (add-hairpin grob)
    (set! hairpins (cons grob hairpins)))
   (define (remove-hairpin grob)
    (set! hairpins (remove (lambda (x) (eq? x grob)) hairpins)))
   (make-engraver
    (listeners
     ((time-signature-event engraver event)
      (for-each extend-hairpin hairpins)
      (set! hairpins '())))
    (acknowledgers
     ((hairpin-interface engraver grob source)
      (add-hairpin grob)))
    (end-acknowledgers
     ((hairpin-interface engraver grob source)
      (remove-hairpin grob))))))

\new Staff \with {
  \consists \extendHairpinsAcrossTimeSignature
}
\fixed c' {
  | \time 3/4 g2 a8 \< b | cis'2 \! r4
  | d'4 \> cis' b | \time 2/4 ais2 \!
  | g4 fis8 \< g | \time 3/4 a8 \! b a2 \>
  | g4 \! f e | \time 2/4 d2 \bar "|."
}
%%%%


-- Aaron Hill

Attachment: hairpin-extend-across-timesig.cropped.png
Description: PNG image


reply via email to

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