lilypond-user-fr
[Top][All Lists]
Advanced

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

Re: Écrire un crescendo en trois syllabes


From: Jacques Menu
Subject: Re: Écrire un crescendo en trois syllabes
Date: Mon, 18 Jan 2021 19:52:17 +0100

Bonsoir Jean-François,

Andrew et Thomas ont proposé cette fonction TextSpannerWithCenteredText pour 
avoir un texte centré, il est peut-être possible de la compléter pour avoir un 
texte au début et à la fin comme dans :

{
  c'8 
  -\tweak bound-details.left.text \markup { "début" }
  -\tweak bound-details.right.text \markup { "fin" }
  \startTextSpan
   [  _\< d'16  e'  ]  f'8  [  e'  ]  \! | % 4
  d'2  ~ _\> | % 5
  d’2 
  \stopTextSpan
}

JM


%%%%%%%%%

\version "2.19.25"


% Annotation bracket with centred text.
% Andrew Bernard and Thomas Morley

TextSpannerWithCenteredText =
#(define-music-function (text) (string?)
   "Use TextSpanner semantics to create spanner brackets with centred text"
   #{
     \once \override TextSpanner.after-line-breaking =
     #(lambda (grob)
        (let* (
                ;; get stencil of grob
                (stil (ly:grob-property grob 'stencil))
                ;; get spanner length
                (spanner-len (interval-length (ly:stencil-extent stil X)))
                ;; make stencil from text arg
                (text-stil (grob-interpret-markup grob (markup text)))
                ;; get text length
                (text-len (interval-length (ly:stencil-extent text-stil X))))
          ;; if text length exceeds the spanner length we cannot really proceed.
          ;; do nothing - make an ordinary text spanner and warn.
          (if (>= text-len spanner-len)
              (begin
               (ly:warning "text length longer than spanner")
               #f
               )
              (let* (
                      ;; get direction, up or down
                      (dir (ly:grob-property grob 'direction))
                      ;; some padding
                      (padding 1)
                      ;; line thickness
                      (thickness 0.25)
                      ;; calculate length considering text length
                      (path-part-len (/ (- spanner-len text-len) 2))
                      ;; make left bracket stencil
                      (path-left-part-stil
                       (make-path-stencil
                        `(
                           moveto 0 ,(* -1 dir)
                           lineto 0 0
                           lineto ,path-part-len 0
                           )
                        thickness 1 1 #f))
                      ;; make right bracket stencil
                      (path-right-part-stil
                       (make-path-stencil
                        `(
                           moveto ,path-part-len ,(* -1 dir)
                           lineto ,path-part-len 0
                           lineto 0 0
                           )
                        thickness 1 1 #f))
                      ;; make complete stencil combining left and right parts
                      ;; and text
                      (full-stil
                       (stack-stencils X RIGHT padding
                         (list
                          path-left-part-stil
                          (centered-stencil text-stil)
                          path-right-part-stil)))
                      )
                ;; set grob stencil to fully constructed stencil
                (ly:grob-set-property! grob 'stencil full-stil)
                ))))
   #}
   )


{
  c' d' ees' fis'
  \once \override TextSpanner.direction = #DOWN

  \TextSpannerWithCenteredText "6\""
  g' \startTextSpan
  a' bes' c'' \stopTextSpan

  \TextSpannerWithCenteredText "x3"
  bes'\startTextSpan a' g' c' | r1 \stopTextSpan
}

%%%%%%%%%

> Le 18 janv. 2021 à 18:21, Seventies <j-f.lucarelli@espace-midi.com> a écrit :
> 
> Bonsoir à l'équipe,
> Je cherche à écrire une nuance crescendo, mais étalée sur plusieurs mesures,
> à la manière de 
> "c r e - - - - s c e n - - - d o", ajustée au nombre de mesures concernées.
> La séparation en 2 syllabes ne pose pas trop de problème dans les snippets,
> mais pour trois syllabes, ça semble nettement plus difficile à trouver.
> 
> Qui aurait une solution ?
> 
> Merci d'avance,
> Jean-François
> 
> 
> 
> -----
> Liste des partitions LilyPond en http://www.espace-midi.com/lilypond
> --
> Sent from: http://lilypond-french-users.1298960.n2.nabble.com/
> 




reply via email to

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