how to avoid barre and fingerboard shift in fret-diagram?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

how to avoid barre and fingerboard shift in fret-diagram?

MarcM

I'm using fret-diagram to print scales and finger patterns.
I'm having the following issues as shown in the picture.
fret_diagram_issue.png

#1 A capo is printed when I add an open string
=> I've added  " (barre-type  . none)" but it did not have any effect
=> I've tried to use the open string notation (3 o) instead of (3 0) but I get an error
(x86)/LilyPond/usr/share/lilypond/current/scm/fret-diagrams.scm:260:19: In procedure > in expression (> fretval maxfret):
C:/Program Files (x86)/LilyPond/usr/share/lilypond/current/scm/fret-diagrams.scm:260:19: Wrong type argument in position 1: o

#2 In the second fret diagram when using an open string a capo is not printed but the fingerboard is shifted. If I replace "3-o" by "3-1-1"
      \fret-diagram #"s:3;f:1;4-5-3;3-o;3-2-1;3-3-2;3-5-3;"

scale-diagram-test.ly
Reply | Threaded
Open this post in threaded view
|

Re: how to avoid barre and fingerboard shift in fret-diagram? [SOLVED]

MarcM

Through this snippet
https://github.com/stevage/Lilypond/blob/master/Documentation/snippets/fret-diagrams-explained-and-developed.ly

and this doc : http://lilypond.org/doc/v2.18/Documentation/notation/instrument-specific-markup

I found out the function in the LSR http://lsr.di.unimi.it/LSR/Item?id=790 appends  '(place-fret) to the (string fret) pairs and thus does not support the syntax to indicate open strings. "(open 4)"

I changed the original function in the LSR to fix that and it works.

% Expand the (string fret) pairs to valid lilypond syntax
% ORIGINAL
#(define (fret-from-list l1 l2 n1)
   (if  (null? l1)
        l2
        (fret-from-list (cdr l1) (append l2 (list (append '(place-fret) (car l1) (inverted (length l2) n1)))) n1)))

% MODIFIED
% to allow to use other syntax of the fret-diagram syntax.
%  the function accepts (string fret) pairs and i added a test to check if the first element of a
% (string fret) pair is a number append '(place-fret) otherwise just return the list

#(define (fret-from-list source target n1)
   (if  (null? source)
        target
        (fret-from-list
           (cdr source)
           (append target (list
                              (if (integer? (car (car source)))
                                  (append '(place-fret) (car source) (inverted (length target) n1))
                                  (car source)
                               )
                           ); list
            )
           n1)))