]> git.donarmstrong.com Git - lilypond.git/blobdiff - Documentation/snippets/new/creating-a-sequence-of-notes-on-various-pitches.ly
Imported Upstream version 2.16.0
[lilypond.git] / Documentation / snippets / new / creating-a-sequence-of-notes-on-various-pitches.ly
diff --git a/Documentation/snippets/new/creating-a-sequence-of-notes-on-various-pitches.ly b/Documentation/snippets/new/creating-a-sequence-of-notes-on-various-pitches.ly
new file mode 100644 (file)
index 0000000..ea2d830
--- /dev/null
@@ -0,0 +1,27 @@
+\version "2.16.0"
+
+\header {
+  lsrtags = "pitches, real-music, really-cool, scheme-language"
+
+  texidoc = "
+In music that contains many occurrences of the same sequence of notes
+at different pitches, the following music function may prove useful.
+It takes a note, of which only the pitch is used.   This example
+creates the rhythm used throughout Mars, from Gustav Holst's The
+Planets.
+
+"
+  doctitle = "Creating a sequence of notes on various pitches"
+}
+
+rhythm =
+#(define-music-function (parser location p) (ly:pitch?)
+   "Make the rhythm in Mars (the Planets) at the given pitch"
+  #{ \times 2/3 { $p 8 $p $p } $p 4 $p $p 8 $p $p 4 #})
+
+\new Staff {
+  \time 5/4
+  \rhythm c'
+  \rhythm c''
+  \rhythm g
+}