]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/ly-examples/tab-example.ly
Rerun scripts/auxiliar/update-with-convert-ly.sh
[lilypond.git] / Documentation / ly-examples / tab-example.ly
1 \version "2.17.6"
2
3 #(set-global-staff-size 22.45)
4
5 #(define (glissando::calc-extra-dy grob)
6    (let* ((original (ly:grob-original grob))
7           (left-bound (ly:spanner-bound original LEFT))
8           (right-bound (ly:spanner-bound original RIGHT))
9           (left-pitch (ly:event-property (event-cause left-bound) 'pitch))
10           (right-pitch (ly:event-property (event-cause right-bound) 'pitch)))
11
12      (if (and (= (ly:pitch-octave left-pitch) (ly:pitch-octave right-pitch))
13               (= (ly:pitch-notename left-pitch) (ly:pitch-notename right-pitch)))
14          (- (ly:pitch-alteration right-pitch) (ly:pitch-alteration left-pitch))
15          0 )))
16
17 \paper {
18   indent= #0
19   line-width= #180
20 }
21
22 upper= \relative c' {
23   \time 4/4
24   \key e \major
25   \set Staff.midiInstrument = #"acoustic guitar (steel)"
26   \set fingeringOrientations = #'(left)
27
28   \partial 4. cis8 e4
29   < cis-1 g'-3 >2 s8 \grace a16 ( \glissando < b-2 >8\3 ) < d-1 > ( b )
30   < e-3 >\2 ( <d-1> b ) \grace < ais-2 >16 ( \glissando a8 g ) s4.
31   s4. < d'\3 g\2 >8 < gis,\4  d'\3 fis\2 >2\arpeggio ~
32   < gis\4 d'\3 fis\2 >2 < b'\2\harmonic e\harmonic >2\fermata
33 }
34
35 lower= \relative c {
36   \set fingeringOrientations = #'(left)
37
38   \partial 4. s4.
39   s4 e,4 s2
40   s2 s8 < e'-3 >4. ~
41   e4 \hideNotes \grace { b8 \glissando s4 } \unHideNotes < e-2 >4\5 e,2 ~
42   e2 < e'\6\harmonic >
43 }
44
45 \score {
46   \new StaffGroup <<
47     \new Staff = "guitar" <<
48       \context Voice = "upper guitar" {
49         \clef "G_8" \voiceOne
50         \override Glissando.gap = #0.5
51         \override Glissando.extra-offset = #'(-0.5 . 0)
52         \override Glissando.springs-and-rods = #ly:spanner::set-spacing-rods
53         \override Glissando.minimum-length = #4
54         \override Glissando.extra-dy = #glissando::calc-extra-dy
55         \upper
56       }
57       \context Voice = "lower guitar" {
58         \clef "G_8" \voiceTwo
59         \override Glissando.bound-details.right.padding = #1
60         \override Glissando.bound-details.left.padding = #0.2
61         \lower
62       }
63     >>
64     \new TabStaff = "tab" <<
65       \context TabVoice = "upper tab" { \clef "moderntab" \voiceOne \upper }
66       \context TabVoice = "lower tab" { \clef "moderntab" \voiceTwo \lower }
67     >>
68   >>
69
70   \layout {
71     \context {
72       \Staff
73       \override StringNumber.transparent = ##t
74     }
75     \context {
76       \TabStaff
77       \revert Arpeggio.stencil
78     }
79   }
80 }