]> git.donarmstrong.com Git - lilypond.git/blobdiff - input/new/letter-tablature-formatting.ly
Doc-es: pre-merge update of texidoc committishes.
[lilypond.git] / input / new / letter-tablature-formatting.ly
index 0fb7fd29bc61cab8aa793d9b9b8c28bc2cca56fa..79da84dff51bbaf350b786d87bef2c063381bd18 100644 (file)
@@ -1,12 +1,39 @@
-\version "2.11.35"
+\version "2.12.0"
 
 \header {
-  lsrtags = "fretted-strings"
-  texidoc = "
-You can format a tablature with letters instead of numbers - so that
-0->a, 1->b, 2->c, etc. 
+  lsrtags = "staff-notation,fretted-strings"
 
-BROKEN IN 2.11, COMMENTED OUT."
+  texidoc = "Tablature can be formatted using letters instead of
+numbers."
   doctitle = "Letter tablature formatting"
 }
-{ c'4 }
+
+#(define (letter-tablature-format str context event)
+  (let*
+      ((tuning (ly:context-property context 'stringTunings))
+       (pitch (ly:event-property event 'pitch)))
+    (make-whiteout-markup
+     (make-vcenter-markup
+      (string (integer->char
+         (+ (char->integer #\a)
+            (- (ly:pitch-semitones pitch)
+            (list-ref tuning (- str 1))))))))))
+
+music = \relative c {
+  c4 d e f
+  g4 a b c
+  d4 e f g
+}
+
+<<
+  \new Staff {
+    \clef "G_8"
+    \music
+  }
+  \new TabStaff \with { 
+    tablatureFormat = #letter-tablature-format
+  }
+  {
+    \music
+  }
+>>