Stefan,

See my answers below.  They are answers that only address setting values in
'details.  You could copy the code from scm/fret-diagrams.scm and make
changes to accomplish all of these things, if you wanted to.  But those
changes would be in your own file.

On Fri, Nov 22, 2024 at 8:07 PM Stefan E. Mueller <[email protected]>
wrote:

> Hi,
>
> I have this fretboard diagram:
>
>
> Is there a possibility to add a closing line at the 5h fret?


 Currently, no.  The particular diagram you are showing does not have a 5th
fret.  It has only the nut (zeroth fret) and frets 1-4.  The strings are
hardcoded to go one fret space below the last fret in the diagram.

It would be relatively easy to add a 'details property that would control
whether or not the strings extend beyond the last fret.

You could hardcode the changed behavior by changing the draw-strings
procedure in fret-diagrams.scm:

    (define (draw-strings)
      "Draw the string lines for a fret diagram with
@var{string-count} strings and frets as indicated in @var{fret-range}.
Line thickness is given by @var{th}, fret & string spacing by
@var{size}.  Orientation is determined by @var{orientation}."
      (let* ((string-list (iota string-count 1 1))
             (string-stencils (map string-stencil string-list)))
        (apply ly:stencil-add empty-stencil string-stencils)))

    (define (string-stencil string)
      "Make a stencil for @code{string}, given the fret-diagram
      overall parameters."
      (let* ((string-coordinate (- string-count string))
             (current-string-thickness
              (* th size (string-thickness string thickness-factor)))
             (fret-half-thick (* size th 0.5))
             (string-half-thick (* current-string-thickness 0.5))
             (start-coordinates
              (stencil-coordinates
               (- fret-half-thick)
               (- (* size string-distance string-coordinate)
                  string-half-thick)))
             (end-coordinates
              (stencil-coordinates
               (+ fret-half-thick
                  (* size fret-distance ( (fret-count fret-range)))) ; this
is the new line
                  ;(* size fret-distance (1+ (fret-count fret-range)))) ;
this was the previous line
               (+ string-half-thick
                  (* size string-distance string-coordinate)))))
        (ly:round-filled-box
         (ordered-cons (car start-coordinates) (car end-coordinates))
         (ordered-cons (cdr start-coordinates) (cdr end-coordinates))
         (* th size))))


> And also I
> would like to to get rid of the dots at first fret on string 1 and 5
>

Just don't include (place-fret 5 1) and (place-fret 1 1) as part of the
diagram.


> and/or be able to increase the bar thickness for the barre (the thickness
> can be changed for "capo", but I could not find a possibility to change
> the thickness for the straight "barre" line).
>

Currently, the barre thickness is hard-coded to be the dot-radius (1/2 the
diameter of the dot).
A new property could easily be added to the details that would set the
thickness of the barre line.  Is your desire to make the barre thickness be
the same as the dot diameter?

You could also edit the draw-barre function in fret-diagrams.scm to
hardcode a new barre thickness:
    (define (draw-barre barre-list)
      "Create barre indications for a fret diagram"
      (let* ((low-fret (car fret-range))
             (barre-vertical-offset 0.5)
             (scale-dot-radius (* size dot-radius))
             (barre-type (assoc-get 'barre-type details 'curved))
             (barre-stils
              (map
               (lambda (barre)
                 (let* ((string1 (car barre))
                        (string2 (cadr barre))
                        (barre-fret (caddr barre))
                        (fret (1+ (- barre-fret low-fret)))
                        (barre-fret-coordinate
                         (+ (1- fret) dot-position))
                        (barre-start-string-coordinate
                         (- string-count string1))
                        (barre-end-string-coordinate
                         (- string-count string2)))
                   (cond
                    ((eq? barre-type 'straight)
                     (make-straight-line-stencil
                      barre-fret-coordinate
                      barre-start-string-coordinate
                      barre-end-string-coordinate
                      (* 2 scale-dot-radius))) ; New line -- change the 2
as desired to adjust the thickness
                      ;scale-dot-radius)) ; Old line
                    ((eq? barre-type 'curved)
                     (make-curved-barre-stencil
                      barre-fret-coordinate
                      barre-start-string-coordinate
                      barre-end-string-coordinate
                      scale-dot-radius)))))
               barre-list)))
        (apply ly:stencil-add empty-stencil barre-stils)))

If you'd like to make the barre thickness and the string overhang
configurable, I'd be happy to help you work through those changes in order
to get them submitted to LilyPond.

HTH,

Carl

Reply via email to