]> git.donarmstrong.com Git - lilypond.git/blobdiff - input/lsr/letter-tablature-formatting.ly
lilypond-book robustness: ensure EOL at the end of @verbatim
[lilypond.git] / input / lsr / letter-tablature-formatting.ly
index 3fb01d3934945689d4bb8fe8f4cb101d458f4792..baf88fa35e4e8b977bc0d8b07fb7caf318911c6f 100644 (file)
@@ -1,14 +1,42 @@
-%% Do not edit this file; it is auto-generated from input/new
+%% Do not edit this file; it is auto-generated from LSR http://lsr.dsi.unimi.it
 %% This file is in the public domain.
-\version "2.11.38"
+\version "2.13.1"
 
 \header {
-  lsrtags = "fretted-strings"
+  lsrtags = "staff-notation, fretted-strings"
+
   texidoc = "
-You can format a tablature with letters instead of numbers - so that
-0->a, 1->b, 2->c, etc. 
+Tablature can be formatted using letters instead of numbers. 
 
-BROKEN IN 2.11, COMMENTED OUT."
+"
   doctitle = "Letter tablature formatting"
 } % begin verbatim
-{ 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
+  }
+>>