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