Subject: Répartir un accord entre les mains

From: Jean Abou Samra <[email-masked]>
Date: Thu, 5 Mar 2020 08:06:06 -0700 (MST)

Bonjour,

Comment ajouter à un accord les signes habituels
qui indiquent qu'une certaine partie doit être jouée
de la main droite du pianiste et d'autres de la main
gauche, comme sur l'image ?
 
Je suis étonné de n'avoir rien trouvé dans tout
le manuel de notation. Aurais-je raté un passage ?

Cordialement,
Jean Abou Samra

<http://lilypond-french-users.1298960.n2.nabble.com/file/t395716/Signe_main_droite.jpg> 

--
Sent from: http://lilypond-french-users.1298960.n2.nabble.com/

---

From: Valentin Villenave <[email-masked]>
Date: Thu, 5 Mar 2020 16:33:46 +0000

> gauche, comme sur l'image ?

Voici ce que j’utilise, mais c’est certainement beaucoup trop
compliqué par rapport à ce que ça pourrait être. Si quelqu’un sur la
liste se sent d’attaque p our le rendre plus simple, plus élégant et
plus intelligent, je l’ajouterai au LSR.

%%%%%%%%%

#(define (add-bracket pos up? text music)
   (if
    (equal? (ly:music-property music 'name) 'EventChord)
    (let ((note (car (ly:music-property music 'elements))))
      (set! (ly:music-property note 'articulations)
            (append
             (ly:music-property note 'articulations)
             (list
              (let ((obj (make-music 'FingeringEvent)))
                (set! (ly:music-property obj 'tweaks)
                      (acons
                       'self-alignment-Y (if up? -1 1)
                       (acons 'text
                              (markup #:bracketText pos up? text)
                              (ly:music-property obj 'tweaks))))
                obj)))))
    music))

#(define-markup-command (bracketText layout props num up? arg)
(number? boolean? markup?)
   (let* ((pos (max 3 (- 10 (- num))))
          (text (markup #:with-dimensions '(0 . 0)'(0 . 0) arg))
          (stack (lambda (x)
                   (markup #:normal-text #:fontsize 3
                           #:center-column
                           ((if up? text "")
                            #:with-dimensions
                            '(0 . .5)
                            (if up?
                                (cons 0 (+ x .2))
                                (cons (- x .2) 0))
                            #:postscript (format #f "
                             .12 setlinewidth
                             .5 0 -.5 0 lineto
                             -.5 0 -.5 ~a lineto
                             stroke" x)
                            (if up? "" text))))))
     (if (not up?) (set! pos (- pos)))
     (interpret-markup layout props (stack pos))))

#(define bracketUp
   (define-music-function (text music) (markup? ly:music?)
     (let ((current-staff-position 0))
       ; this shouldn't be needed!!!
       (set! current-staff-position -4)
       (make-music 'ApplyOutputEvent
                   'origin (*location*)
                   'context-type 'Voice
                   'procedure
                   (lambda (grob grob-origin context)
                     (let ((staff-pos (ly:grob-property grob 'staff-position)))
                       (if (number? staff-pos)
                           (set! current-staff-position staff-pos)))))
       #{ \once \set fingeringOrientations = #'(left)
          \once \override Fingering.X-extent = #'(-2.0 . 0.0)
          $(add-bracket current-staff-position #t text music)
          $music #})))

#(define bracketDown
   (define-music-function (text music) (markup? ly:music?)
     (let ((current-staff-position 0))
       ; this shouldn't be needed!!!
       (set! current-staff-position -1)
       (make-music 'ApplyOutputEvent
                   'origin (*location*)
                   'context-type 'Voice
                   'procedure
                   (lambda (grob grob-origin context)
                     (let ((staff-pos (ly:grob-property grob 'staff-position)))
                       (if (number? staff-pos)
                           (set! current-staff-position staff-pos)))))
       #{ \once \set fingeringOrientations = #'(left)
          \once \override Fingering.X-extent = #'(-2.0 . 0.0)
          $(add-bracket current-staff-position #f text music)
          $music #})))

{
  \clef bass
  << \bracketUp "m.d." <b> \\ <d g> >>
}

%%

V.