Hello Peter,

Am 04.05.2011 20:05, schrieb Peter Crighton:
In 2.13.61 half notes in tab notation are distinguished from quarter notes through a second stem. Now I haven't seen this method before – it would seem natural to me to draw a circle around the "tab note", the number, and have only one stem like in normal notation.
The same would apply to whole notes, but of course without the stem.
One may discuss about aesthetics, but I have seen this way of displaying half notes and whole notes.

How can I achieve this kind of notation? Can I?
Yes! See the attached example. I tried to comment what I have done.

I is untested for working with harmonics - should the circle be drawn around the fret number only,
or should it include the parentheses and the angle brackets?


In chords I would use a single circle (an ellipse, to be correct) around all "tab notes" instead of drawing a circle around every single one. This would be more difficult if possible at all, I reckon, but it would be great to have this possibility…
This is more difficult to implement, and, to be honest, I don't know how.

HTH,

Marc


_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

\version "2.13.61"

%
% this is (mostly) copied from scm/tablature.scm -> tab-note-head::print
#(define-public (tab-note-head::my-print grob)
  (define (is-harmonic? grob)
    (let ((arts (ly:event-property (event-cause grob) 'articulations)))
      (not (null? (filter (lambda (a)
                            (ly:in-event-class? a 'harmonic-event))
                          arts)))))

  (let* ((cautionary (ly:grob-property grob 'display-cautionary #f))
         (details (ly:grob-property grob 'details '()))
         (harmonic-props (assoc-get 'harmonic-properties details '()))
         (harmonic-angularity (assoc-get 'angularity harmonic-props 2))
         (harmonic-half-thick (assoc-get 'half-thickness harmonic-props 0.075))
         (harmonic-padding (assoc-get 'padding harmonic-props 0))
         (harmonic-proc (assoc-get 'procedure harmonic-props parenthesize-stencil))
         (harmonic-width (assoc-get 'width harmonic-props 0.25))
         (cautionary-props (assoc-get 'cautionary-properties details '()))
         (cautionary-angularity (assoc-get 'angularity cautionary-props 2))
         (cautionary-half-thick (assoc-get 'half-thickness cautionary-props 0.075))
         (cautionary-padding (assoc-get 'padding cautionary-props 0))
         (cautionary-proc (assoc-get 'procedure cautionary-props parenthesize-stencil))
         (cautionary-width (assoc-get 'width cautionary-props 0.25))
         (output-grob (ly:text-interface::print grob))
         (duration-log (ly:grob-property grob 'duration-log))
         (ref-grob (grob-interpret-markup grob "8"))
         (offset-factor (assoc-get 'head-offset details 3/5))
         (column-offset (* offset-factor
                           (interval-length
                             (ly:stencil-extent
                               (grob-interpret-markup grob "8")
                               X)))))
    (if (is-harmonic? grob)
        (set! output-grob (harmonic-proc output-grob
                                         harmonic-half-thick
                                         harmonic-width
                                         harmonic-angularity
                                         harmonic-padding)))
    (if cautionary
        (set! output-grob (cautionary-proc output-grob
                                           cautionary-half-thick
                                           cautionary-width
                                           cautionary-angularity
                                           cautionary-padding)))
    ;; the next two lines draw circles around half and whole notes
    ;; the numbers 0.1 and 0.2 are hardcoded (ugh!) and resemble
    ;; the line-thickness and the padding
    (if (> 2 duration-log)
        (set! output-grob (circle-stencil output-grob 0.1 0.2)))
    (ly:stencil-translate-axis (centered-stencil output-grob)
                               column-offset
                               X)))

music = { c4 d e2 | f1 }

\score {
  \new TabStaff {
    \new TabVoice {
      \tabFullNotation
      % use the new function instead of the standard callback
      \override TabNoteHead #'stencil = #tab-note-head::my-print
      % don't draw double stems for half notes
      \revert TabVoice.Stem #'stencil
      \music }
  }
}
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to