]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/web/ly-examples/tab-example.ly
Web: rename web/examples to web/ly-examples
[lilypond.git] / Documentation / web / ly-examples / tab-example.ly
1 \version "2.13.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 %% Hide fret number: useful to draw slide into/from a casual point of
18 %% the fretboard.
19 hideFretNumber = { \once \override TabNoteHead #'transparent = ##t
20                    \once \override NoteHead #'transparent = ##t
21                    \once \override Stem #'transparent = ##t
22                    \once \override NoteHead #'no-ledgers = ##t
23 }
24
25 \paper {
26   indent= #0
27   line-width= #180
28 }
29
30 upper=  \relative c' {
31   \time 4/4
32   \key e \major
33   \set Staff.midiInstrument = #"acoustic guitar (steel)"
34   \set fingeringOrientations = #'(left)
35
36   %\override Staff.Glissando #'extra-offset = #' (0.0 . 1.0)
37   \partial 4. \acciaccatura c16 \glissando cis8  e4
38   < cis-1 g'-3 >2 s8 \grace a16 ( \glissando <b-2>8\3 )  <d-1> ( b ) |
39   <e-3>\2 ( <d-1> b ) \grace <ais-2>16 ( \glissando  a8  g ) s4. |
40   s4.  < d'\3 g\2 >8  < gis,\4  d'\3 fis\2 >2\arpeggio ~ |
41
42   < gis\4  d'\3 fis\2 >2  < b'\2\harmonic e\harmonic >2\fermata |
43
44 }
45
46 lower=  \relative c {
47   \set fingeringOrientations = #'(left)
48
49   \partial 4. s4. |
50   s4  e,4  s2 |
51   s2 s8 <e'-3>4. ~ |
52   e4  \hideFretNumber \grace { b8 \glissando s4 }  <e-2>4\5  e,2 ~ |
53
54   e2  < e'\6\harmonic > |
55 }
56
57 \score {
58   \new StaffGroup <<
59     \new Staff = "guitar" <<
60       \context Voice = "upper guitar" { \clef "G_8" \voiceOne
61                                         \override Glissando #'gap = #0.5
62                                         \override Glissando #'extra-offset = #'(-0.5 . 0)
63                                         \override Glissando #'springs-and-rods = #ly:spanner::set-spacing-rods
64                                         \override Glissando #'minimum-length = #4
65                                         \override Glissando #'extra-dy = #glissando::calc-extra-dy
66                                         \upper }
67       \context Voice = "lower guitar" { \clef "G_8" \voiceTwo
68                                         \override  Glissando #'bound-details #'right #'padding = #1
69                                         \override  Glissando #'bound-details #'left #'padding = #0.2
70                                         \lower }
71     >>
72     \new TabStaff = "tab" <<
73       \context TabVoice = "upper tab" { \clef "moderntab" \voiceOne \upper }
74       \context TabVoice = "lower tab" { \clef "moderntab" \voiceTwo \lower }
75     >>
76   >>
77  %{
78  \midi {
79     \context {
80       \Score tempoWholesPerMinute = #(ly:make-moment 120 4)
81     }
82   }
83  %}
84
85  \layout {
86     \context {
87     \Staff
88     \override StringNumber #'transparent = ##t
89     }
90
91     \context {
92     \TabStaff
93     \revert Arpeggio #'stencil
94     }
95   }
96 }