@end ignore
+@item
+@code{TabStaff} is now able to print micro-tones for bendings etc.
+@lilypond[quote,verbatim]
+\layout {
+ \context {
+ \Score
+ noteToFretFunction = #(determine-frets #t)
+ }
+}
+
+mus = \relative { c'4 cih d dih }
+
+<<
+ \new Staff << \clef "G_8" \mus >>
+ \new TabStaff \mus
+>>
+@end lilypond
+
@item
All of @code{\override}, @code{\revert}, @code{\set}, and
@code{\unset} now work with the @code{\once} prefix for making
The modern tab clef supports tablatures from 4 to 7 strings.
+@cindex micro-tones, tab
+@cindex quarter-tones, tab
+@cindex tab micro-tones
+@cindex tab quarter-tones
+
+@code{TabStaff} may support micro-tones like quarter-tones, which
+can be played using bendings.
+@code{noteToFretFunction = #(determine-frets #t)} needs to be set in
+Score-context. However, micro-tones are not supperted in @code{FretBoards}.
+
+@lilypond[quote,ragged-right,verbatim]
+\layout {
+ \context {
+ \Score
+ noteToFretFunction = #(determine-frets #t)
+ }
+}
+
+custom-tuning = \stringTuning <e, a, d ges beh eeh'>
+
+mus = \relative {
+ eeses'4
+ eeseh
+ ees
+ eeh
+ e
+ eih
+ eis
+ eisih
+ eisis
+}
+
+<<
+ \new Staff << \clef "G_8" \mus >>
+ \new TabStaff \with { stringTunings = \custom-tuning } \mus
+>>
+@end lilypond
+
@seealso
Notation Reference:
@ref{Absolute octave entry},
--- /dev/null
+\version "2.19.31"
+
+\header {
+ texidoc = "The @code{TabStaff} will print micro-tones as mixed numbers of
+fret-number and a fraction.
+@code{noteToFretFunction = #(my-determine-frets #t)} needs to be set in Score.
+@code{FretBoards} will print those micro-tones only if they can be found in the
+chosen settings for @code{stringTunings}, otherwise a warning (surpressed here)
+will be printed and an empty @code{FretBoard} returned. Which should be the
+case here for the first pitch: @code{gih}"
+}
+
+#(ly:set-option 'warning-as-error #f)
+#(ly:expect-warning (_ "No string for pitch ~a (given frets ~a)") #{ gih #} '())
+
+\layout {
+ \context {
+ \Score
+ noteToFretFunction = #(determine-frets #t)
+ }
+}
+
+custom-tuning = \stringTuning <e, a, d ges beh eeh'>
+
+mus = \relative {
+ gih4
+ eeses'
+ eeseh
+ ees
+ eeh
+ e
+ eih
+ eis
+ eisih
+ eisis
+}
+
+<<
+ \new Staff << \clef "G_8" \mus >>
+ \new FretBoards \with { stringTunings = \custom-tuning } \mus
+ \new TabStaff \with { stringTunings = \custom-tuning } \mus
+>>
;; Create the dot-placement list for the grob
(set! (ly:grob-property grob 'dot-placement-list) placement-list)))
-(define-public
- (determine-frets context notes specified-info . rest)
+(define*-public
+ ((determine-frets #:optional (support-non-integer-fret? #f))
+ context notes specified-info . rest)
"Determine string numbers and frets for playing @var{notes}
as a chord, given specified information @var{specified-info}.
@var{specified-info} is a list with two list elements,
is not @code {#f}. If @var{rest} is present, it contains the
@code{FretBoard} grob, and a fretboard will be
created. Otherwise, a list of @code{(string fret finger)} lists will
-be returned."
+be returned.
+If the optional @var{support-non-integer-fret?} is set @code{#t}, micro-tones
+are supported for TabStaff, but not not for FretBoards."
;; helper functions
(and (or (and (not restrain-open-strings)
(zero? fret))
(>= fret minimum-fret))
- (integer? fret)
+ (if (and support-non-integer-fret? (null? rest))
+ (integer? (truncate fret))
+ (integer? fret))
(close-enough fret))))
(define (open-string string pitch)
(if (< this-fret 0)
(ly:warning (_ "Negative fret for pitch ~a on string ~a")
(car pitch-entry) string)
- (if (not (integer? this-fret))
+ (if (and (not (integer? this-fret)) (not support-non-integer-fret?))
(ly:warning (_ "Missing fret for pitch ~a on string ~a")
(car pitch-entry) string)))
(delete-free-string string)
;; Display the fret number as a number
(define-public (fret-number-tablature-format
context string-number fret-number)
- (make-vcenter-markup
- (format #f "~a" fret-number)))
+ (if (integer? fret-number)
+ (make-vcenter-markup
+ (format #f "~a" fret-number))
+ ;; for non-integer fret-number print p.e. "2½"
+ (let* ((whole-part (truncate fret-number))
+ (remaining (- fret-number whole-part))
+ (fret
+ (if (and (zero? whole-part) (not (zero? remaining)))
+ ""
+ (format #f "~a" whole-part)))
+ (frac
+ (if (zero? remaining)
+ ""
+ (format #f "~a" remaining))))
+ (make-concat-markup
+ (list (make-vcenter-markup fret)
+ (make-vcenter-markup
+ ;; the value `-2.5' is my choice
+ (make-fontsize-markup -2.5 frac)))))))
;; The 5-string banjo has got an extra string, the fifth (duh), which
;; starts at the fifth fret on the neck. Frets on the fifth string