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

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

Re: Fonction pour Ambitus


From: Jean Abou Samra
Subject: Re: Fonction pour Ambitus
Date: Sun, 28 Aug 2022 00:15:32 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0



Le 27/08/2022 à 16:19, Ya Gloops a écrit :
Bonjour à tous!
J'aime imprimer systématiquement l'ambitus sur mes partitions, malheureusement 
lorsque celui-ci est inférieur à une tierce les notes se chevauchent...

\version "2.23.12"
\score {
   { <c' d'>}
   \layout {
     \context {\Staff \consists Ambitus_engraver}
   }
}

Y'a t'il possibilité de faire se décaler les notes trop proche, comme le fait 
la notation des accords?
Ou bien, moins séduisant mais pratique, d'annuler automatiquement l'impression 
de l'ambitus au cas ou celui-ci est inférieur à une tierce?




Bonjour,

Les ambitus ne sont effectivement pas prévus pour des amplitudes
si courtes...

Une solution pour la première option :


\version "2.23.12"

\layout {
  #(use-modules (ice-9 match))
  \context {
    \Staff
    \override Ambitus.before-line-breaking =
      #(lambda (grob)
         (define (staff-position head)
           (ly:grob-property head 'staff-position))
         (match-let
               (((head-down head-up)
                 (sort
                  (filter (lambda (g)
                            (grob::has-interface g 'note-head-interface))
                          (ly:grob-array->list (ly:grob-object grob 'elements)))
                  (comparator-from-key staff-position <))))
           (when (<= (- (staff-position head-up)
                        (staff-position head-down))
                     1)
             (let ((len (interval-length (ly:grob-extent head-up head-up X))))
               (ly:grob-translate-axis! head-up len X)))))
  }
}

\score {
  { <c' d'>}
  \layout {
    \context {\Staff \consists Ambitus_engraver}
  }
}


Et pour la deuxième option :

\version "2.23.12"

\layout {
  #(use-modules (ice-9 match))
  \context {
    \Staff
    \override Ambitus.before-line-breaking =
      #(lambda (grob)
         (define (staff-position head)
           (ly:grob-property head 'staff-position))
         (match-let*
               ((elts (ly:grob-array->list (ly:grob-object grob 'elements)))
                ((head-down head-up)
                 (sort
                  (filter (lambda (g)
                            (grob::has-interface g 'note-head-interface))
                          elts)
                  (comparator-from-key staff-position <))))
           (when (<= (- (staff-position head-up)
                        (staff-position head-down))
                     1)
             (for-each ly:grob-suicide! elts)
             (ly:grob-suicide! grob))))
  }
}

\score {
  { <c' d'>}
  \layout {
    \context {\Staff \consists Ambitus_engraver}
  }
}



Cordialement,
Jean




reply via email to

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