]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/extending-glissandi-across-repeats.ly
Merge remote-tracking branch 'origin/master' into translation
[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
27 repeatGliss = #(define-music-function (parser location grace)
28   (ly:pitch?)
29   #{
30     % the next two lines ensure the glissando is long enough
31     % to be visible
32     \once \override Glissando.springs-and-rods
33       = #ly:spanner::set-spacing-rods
34     \once \override Glissando.minimum-length = #3.5
35     \once \hideNotes
36     \grace $grace \glissando
37   #})
38
39 \score {
40   \relative c'' {
41     \repeat volta 3 { c4 d e f\glissando }
42     \alternative {
43       { g2 d }
44       { \repeatGliss f g2 e }
45       { \repeatGliss f e2 d }
46     }
47   }
48 }
49
50 music =  \relative c' {
51   \voiceOne
52   \repeat volta 2 {
53     g a b c\glissando
54   }
55   \alternative {
56     { d1 }
57     { \repeatGliss c e1 }
58   }
59 }
60
61 \score {
62   \new StaffGroup <<
63     \new Staff <<
64       \context Voice { \clef "G_8" \music }
65     >>
66     \new TabStaff  <<
67       \context TabVoice { \clef "moderntab" \music }
68     >>
69   >>
70 }