2015-05-20 13:16 GMT+02:00 pls <address@hidden>:
Begin forwarded message:
From: pls <address@hidden> Subject: Re: how to add barre indications to automatic fret diagrams? Date: 20. Mai 2015 13:12:30 MESZ To: Stephen MacNeil <address@hidden>
Hi Stephen, On 20.05.2015, at 13:02, Stephen MacNeil <address@hidden> wrote:
sorry forgot one
\version "2.18.2" barre = #(define-music-function (barre location str ) (number?) #{ \once \override FretBoard.before-line-breaking = #(lambda (grob) ;(display (ly:grob-property grob 'dot-placement-list)) (ly:grob-set-property! grob 'dot-placement-list (cons `(barre 6 1 ,str) (ly:grob-property grob 'dot-placement-list))))
#}) fMajorEShape = { <f,-1 c-3 f-4 a-2 c'-1 f'-1> } gMajorEShape = { \transpose f g { \fMajorEShape } }
\new FretBoards { \barre #3 \transpose f g { \fMajorEShape } \barre #4 \gMajorEShape \barre #3 <g,-1 d-3 g-4 b-2 d'-1 g'-1> \set FretBoards.minimumFret = #3 \barre #4 \gMajorEShape }
Yes, that’s what I was looking for! Thank you very much! I cleaned it up a little bit to get rid of some unnecessary bits and pieces (and to make it easier to understand what it does):
\version "2.19.15"
barre = #(define-music-function (bend location str ) (number?) #{ \once \override FretBoard.before-line-breaking = #(lambda (grob) ;(display (ly:grob-property grob 'dot-placement-list)) (ly:grob-set-property! grob 'dot-placement-list (cons `(barre 6 1 ,str) (ly:grob-property grob 'dot-placement-list)))) #})
fMajorEShape = { <f,-1 c-3 f-4 a-2 c'-1 f'-1> }
\new FretBoards { \barre #1 \fMajorEShape \barre #3 \transpose f g { \fMajorEShape } \barre #5 \transpose f a { \fMajorEShape } \barre #7 \transpose f b { \fMajorEShape } }
Thanks again! patrick
More automated:
\version "2.19.15"
\new FretBoards \transpose c d {
\override FretBoard.before-line-breaking = #(lambda (grob) (let* ((dots-list (ly:grob-property grob 'dot-placement-list)) (fingered-frets (filter (lambda (d) (and (eq? 'place-fret (car d)) (>= (length d) 4))) dots-list)) ;; TODO do better mapping, loop or the like! (finger-1 (filter (lambda (f) (and (number? (last f)) (= (last f) 1))) fingered-frets)) (finger-2 (filter (lambda (f) (and (number? (last f)) (= (last f) 2))) fingered-frets)) (finger-3 (filter (lambda (f) (and (number? (last f)) (= (last f) 3))) fingered-frets)) (finger-4 (filter (lambda (f) (and (number? (last f)) (= (last f) 4))) fingered-frets)) (barre-1 (if (> (length finger-1) 1) (let* ((strgs (sort (map cadr finger-1) >)) ) (list 'barre (car strgs) (last strgs) (third (car finger-1)))) '())) (barre-2 (if (> (length finger-2) 1) (let* ((strgs (sort (map cadr finger-2) >)) ) (list 'barre (car strgs) (last strgs) (third (car finger-2)))) '())) (barre-3 (if (> (length finger-3) 1) (let* ((strgs (sort (map cadr finger-3) >)) ) (list 'barre (car strgs) (last strgs) (third (car finger-3)))) '())) (barre-4 (if (> (length finger-4) 1) (let* ((strgs (sort (map cadr finger-4) >)) ) (list 'barre (car strgs) (last strgs) (third (car finger-4)))) '())) (barres (filter (lambda (l) (not (null? l))) (list barre-1 barre-2 barre-3 barre-4))))
(ly:grob-set-property! grob 'dot-placement-list (append barres dots-list))))
<f,-1 c-3 f-4 a-2 c'-1 f'-1>
\override Score.RehearsalMark.self-alignment-X = #LEFT \mark \markup \fontsize #-6 \column { "transposing" "this one," "will be" "strange ofc" } <a, e-1 a-1 cis'-2 e'>
<bes,-1 f-2 bes-3 d'-4 f'-1>
<a,-2 d-2 fis-1 c'-3 e'-3 a'-3> }
Nice! Thanks a lot.
Yes, transposing chords with open strings probably poses a problem. Fingering information would have to be included automatically in order to decide whether they should be part of a barre. I’d think it’s safe to assume that transposed open strings in chords will always be played with the first finger.
Thanks again patrick |