]> git.donarmstrong.com Git - lilypond.git/blobdiff - Documentation/snippets/new/extending-glissandi-across-repeats.ly
Imported Upstream version 2.18.0
[lilypond.git] / Documentation / snippets / new / extending-glissandi-across-repeats.ly
diff --git a/Documentation/snippets/new/extending-glissandi-across-repeats.ly b/Documentation/snippets/new/extending-glissandi-across-repeats.ly
new file mode 100644 (file)
index 0000000..0c7496c
--- /dev/null
@@ -0,0 +1,62 @@
+\version "2.17.6"
+
+\header {
+  lsrtags = "staff-notation, tweaks-and-overrides"
+  texidoc = "
+A glissando which extends into several @code{\alternative} blocks
+can be simulated by adding a hidden grace note with a glissando
+at the start of each @code{\alternative} block.  The grace note
+should be at the same pitch as the note which starts the initial
+glissando.  This is implemented here with a music function which
+takes the pitch of the grace note as its argument.
+
+Note that in polyphonic music the grace note must be matched with
+corresponding grace notes in all other voices.
+"
+  doctitle = "Extending glissandi across repeats"
+}
+
+repeatGliss = #(define-music-function (parser location grace)
+  (ly:pitch?)
+  #{
+    % the next two lines ensure the glissando is long enough
+    % to be visible
+    \once \override Glissando.springs-and-rods
+      = #ly:spanner::set-spacing-rods
+    \once \override Glissando.minimum-length = #3.5
+    \once \hideNotes
+    \grace $grace \glissando
+  #})
+
+\score {
+  \relative c'' {
+    \repeat volta 3 { c4 d e f\glissando }
+    \alternative {
+      { g2 d }
+      { \repeatGliss f g2 e }
+      { \repeatGliss f e2 d }
+    }
+  }
+}
+
+music =  \relative c' {
+  \voiceOne
+  \repeat volta 2 {
+    g a b c\glissando
+  }
+  \alternative {
+    { d1 }
+    { \repeatGliss c e1 }
+  }
+}
+
+\score {
+  \new StaffGroup <<
+    \new Staff <<
+      \context Voice { \clef "G_8" \music }
+    >>
+    \new TabStaff  <<
+      \context TabVoice { \clef "moderntab" \music }
+    >>
+  >>
+}
\ No newline at end of file