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

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

Re: Fonction pour Ambitus


From: Ya Gloops
Subject: Re: Fonction pour Ambitus
Date: Sun, 28 Aug 2022 10:09:40 +0000 (UTC)

Mince ça créer une erreur lorsqu'il n'y a que des silences...

\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 {
  { r }
  \layout {
    \context {\Staff \consists Ambitus_engraver}
  }
}






Le dimanche 28 août 2022 à 00:22:25 UTC+2, yagloops <yagloops@yahoo.fr> a écrit 
: 








Wouaww ! Le beurre l’argent du beurre la crémière et la crémerie en plus… 
Énorme Jean !!! 


Le 28 août 2022 à 00:15 +0200, Jean Abou Samra <jean@abou-samra.fr>, a écrit :

> 
> 
> 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]