]> git.donarmstrong.com Git - lilypond.git/blob - input/new/letter-tablature-formatting.ly
Merge master into nested-bookparts
[lilypond.git] / input / new / letter-tablature-formatting.ly
1 \version "2.11.61"
2
3 \header {
4   lsrtags = "staff-notation,fretted-strings"
5
6   texidoc = "Tablature can be formatted using letters instead of
7 numbers."
8   doctitle = "Letter tablature formatting"
9 }
10
11 #(define (letter-tablature-format str context event)
12   (let*
13       ((tuning (ly:context-property context 'stringTunings))
14        (pitch (ly:event-property event 'pitch)))
15     (make-whiteout-markup
16      (make-vcenter-markup
17       (string (integer->char
18          (+ (char->integer #\a)
19             (- (ly:pitch-semitones pitch)
20             (list-ref tuning (- str 1))))))))))
21
22 music = \relative c {
23   c4 d e f
24   g4 a b c
25   d4 e f g
26 }
27
28 <<
29   \new Staff {
30     \clef "G_8"
31     \music
32   }
33   \new TabStaff \with { 
34     tablatureFormat = #letter-tablature-format
35   }
36   {
37     \music
38   }
39 >>