]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/new/extending-glissandi-across-repeats.ly
Merge remote-tracking branch 'origin/master' into translation
[lilypond.git] / Documentation / snippets / new / extending-glissandi-across-repeats.ly
1 \version "2.17.6"
2
3 \header {
4   lsrtags = "staff-notation, tweaks-and-overrides"
5   texidoc = "
6 A glissando which extends into several @code{\alternative} blocks
7 can be simulated by adding a hidden grace note with a glissando
8 at the start of each @code{\alternative} block.  The grace note
9 should be at the same pitch as the note which starts the initial
10 glissando.  This is implemented here with a music function which
11 takes the pitch of the grace note as its argument.
12
13 Note that in polyphonic music the grace note must be matched with
14 corresponding grace notes in all other voices.
15 "
16   doctitle = "Extending glissandi across repeats"
17 }
18
19 repeatGliss = #(define-music-function (parser location grace)
20   (ly:pitch?)
21   #{
22     % the next two lines ensure the glissando is long enough
23     % to be visible
24     \once \override Glissando.springs-and-rods
25       = #ly:spanner::set-spacing-rods
26     \once \override Glissando.minimum-length = #3.5
27     \once \hideNotes
28     \grace $grace \glissando
29   #})
30
31 \score {
32   \relative c'' {
33     \repeat volta 3 { c4 d e f\glissando }
34     \alternative {
35       { g2 d }
36       { \repeatGliss f g2 e }
37       { \repeatGliss f e2 d }
38     }
39   }
40 }
41
42 music =  \relative c' {
43   \voiceOne
44   \repeat volta 2 {
45     g a b c\glissando
46   }
47   \alternative {
48     { d1 }
49     { \repeatGliss c e1 }
50   }
51 }
52
53 \score {
54   \new StaffGroup <<
55     \new Staff <<
56       \context Voice { \clef "G_8" \music }
57     >>
58     \new TabStaff  <<
59       \context TabVoice { \clef "moderntab" \music }
60     >>
61   >>
62 }