]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/letter-tablature-formatting.ly
LSR: Update.
[lilypond.git] / Documentation / snippets / letter-tablature-formatting.ly
1 %% Do not edit this file; it is automatically
2 %% generated from LSR http://lsr.dsi.unimi.it
3 %% This file is in the public domain.
4 \version "2.13.4"
5
6 \header {
7   lsrtags = "staff-notation, fretted-strings"
8
9   texidoc = "
10 Tablature can be formatted using letters instead of numbers.
11
12 "
13   doctitle = "Letter tablature formatting"
14 } % begin verbatim
15
16 #(define (letter-tablature-format str context event)
17   (let ((tuning (ly:context-property context 'stringTunings))
18         (pitch (ly:event-property event 'pitch)))
19     (make-whiteout-markup
20      (make-vcenter-markup
21       (string (integer->char
22          (+ (char->integer #\a)
23             (- (ly:pitch-semitones pitch)
24             (list-ref tuning (- str 1))))))))))
25
26 music = \relative c {
27   c4 d e f
28   g4 a b c
29   d4 e f g
30 }
31
32 <<
33   \new Staff {
34     \clef "G_8"
35     \music
36   }
37   \new TabStaff \with {
38     tablatureFormat = #letter-tablature-format
39   }
40   {
41     \music
42   }
43 >>