@item
LilyPond is now licensed under the GNU GPL v3+.
+@item
+In tablature, frets can be indicated with labels other than numbers:
+
+@lilypond[verbatim,quote,relative=1]
+\new TabStaff
+\with {
+ stringTunings = #'(17 14 9 5 2 -3)
+ tablatureFormat = #fret-letter-tablature-format
+}
+\new TabVoice {
+ \set fretLabels = #`(,(markup #:with-color red "a")
+ "b"
+ ,(markup #:italic #:smaller "c"))
+ <f d>4. <bes>8 <g e>4
+}
+@end lilypond
+
+@item
+Layout objects can be printed over a white background, which whites-out objects
+in lower layers which lie beneath:
+
+@lilypond[verbatim,quote,relative=1]
+\time 3/4
+\override Staff.StaffSymbol #'layer = #4
+\once \override Tie #'layer = #2
+b'2.~
+\once \override Staff.TimeSignature #'whiteout = ##t
+\once \override Staff.TimeSignature #'layer = #3
+\time 5/4
+b4
+@end lilypond
+
@item
Chords can be repeated using the @code{q} shortcut:
--- /dev/null
+\version "2.13.9"
+
+\header { texidoc = "A sample tablature with lettered tab,
+using fretLabels to modify the fret letters.
+
+By default, letters are drawn sequentially from the alphabet,
+but if the context property fretLabels is defined, these are
+substituted. If specified, the length of fretLabels must be
+sufficient to label all the frets used. A warning is issued
+if the length is too short.
+"
+}
+
+notes = \relative c' {
+ \time 3/4
+ <f d>4. <bes>8 <g e>4
+ \set fretLabels = #`("a" "b" ,(markup #:italic #:smaller "c"))
+ <f d>4. <bes>8 <g e>4
+ \set fretLabels = #`(,(markup #:with-color red "a")
+ "b"
+ ,(markup #:italic #:smaller "c"))
+ <f d>4. <bes>8 <g e>4
+ \set fretLabels = #'("α" "β" "γ")
+ <f d>4. <bes>8 <g e>4
+}
+
+\score {
+ \new TabStaff
+ \with {
+ stringTunings = #'(17 14 9 5 2 -3)
+ tablatureFormat = #fret-letter-tablature-format
+ }
+ \new TabVoice {
+ \notes
+ }
+}
+
+
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; tablature
-;; The TabNoteHead tablatureFormat callback.
-;; Compute the text grob-property
-(define-public (fret-number-tablature-format string context event)
+;; The TabNoteHead tablatureFormat callbacks.
+
+;; Calculate the fret from pitch and string number as letter
+;; The fret letter is taken from 'fretLabels if present
+(define-public (fret-letter-tablature-format string-number context event)
+ (let* ((tuning (ly:context-property context 'stringTunings))
+ (pitch (ly:event-property event 'pitch))
+ (labels (ly:context-property context 'fretLabels))
+ (fret (- (ly:pitch-semitones pitch)
+ (list-ref tuning (- string-number 1)))))
+ (make-vcenter-markup
+ (cond
+ ((= 0 (length labels))
+ (string (integer->char (+ fret (char->integer #\a)))))
+ ((and (<= 0 fret) (< fret (length labels)))
+ (list-ref labels fret))
+ (else
+ (ly:warning "No label for fret ~a (~a on string ~a);
+only ~a fret labels provided"
+ fret pitch string-number (length labels))
+ ".")))))
+
+;; Calculate the fret from pitch and string number as number
+(define-public (fret-number-tablature-format string-number context event)
(let* ((tuning (ly:context-property context 'stringTunings))
(pitch (ly:event-property event 'pitch)))
-
- (make-whiteout-markup
- (make-vcenter-markup
- (format
- "~a"
- (- (ly:pitch-semitones pitch)
- (list-ref tuning
- ;; remove 1 because list index starts at 0
- ;;and guitar string at 1.
- (1- string))))))))
+ (make-vcenter-markup
+ (format
+ "~a"
+ (- (ly:pitch-semitones pitch)
+ (list-ref tuning
+ ;; remove 1 because list index starts at 0
+ ;;and guitar string at 1.
+ (1- string-number)))))))
;; The 5-string banjo has got a extra string, the fifth (duh), which
;; starts at the fifth fret on the neck. Frets on the fifth string
;; the "first fret" on the fifth string is really the sixth fret
;; on the banjo neck.
;; We solve this by defining a new fret-number-tablature function:
-(define-public (fret-number-tablature-format-banjo string context event)
+(define-public (fret-number-tablature-format-banjo string-number context event)
(let* ((tuning (ly:context-property context 'stringTunings))
(pitch (ly:event-property event 'pitch)))
-
- (make-whiteout-markup
- (make-vcenter-markup
- (let ((fret (- (ly:pitch-semitones pitch) (list-ref tuning (1- string)))))
- (number->string (cond
- ((and (> fret 0) (= string 5))
- (+ fret 5))
- (else fret))))))))
+ (make-vcenter-markup
+ (let ((fret (- (ly:pitch-semitones pitch)
+ (list-ref tuning (1- string-number)))))
+ (number->string (cond
+ ((and (> fret 0) (= string-number 5))
+ (+ fret 5))
+ (else fret)))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;