Jump to content

Creating a sequence of notes on various pitches: Difference between revisions

From LilyPond wiki
Import snippet from LSR
 
mNo edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 3: Line 3:
This example creates the rhythm used throughout ''Mars'', from Gustav Holst's ''The Planets''.
This example creates the rhythm used throughout ''Mars'', from Gustav Holst's ''The Planets''.


<lilypond version="2.24.0">
<lilypond version="2.24">
rhythm =
rhythm =
#(define-music-function (p) (ly:pitch?)
#(define-music-function (p) (ly:pitch?)
Line 17: Line 17:
</lilypond>
</lilypond>


[[Category:Scheme]]
[[Category:Pitches]]
[[Category:Pitches]]
[[Category:Scheme]]
[[Category:Real music]]
[[Category:Real music]]
[[Category:Really cool]]
[[Category:Really cool]]
[[Category:Scheme]]
[[Category:Included in the official documentation]]
[[Category:Included in the official documentation]]
[[Category:Snippet]]

Latest revision as of 10:25, 26 December 2025

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.

\version "2.24"

rhythm =
#(define-music-function (p) (ly:pitch?)
   "Make the rhythm in Mars (the Planets) at the given pitch"
  #{ \tuplet 3/2 { $p 8 8 8 } 4 4 8 8 4 #})

\new Staff {
  \time 5/4
  \rhythm c'
  \rhythm c''
  \rhythm g
}