Lilypond function; add rhythm to note

How can you write a Lilypond function that takes a note and outputs a note with a beat? say: input: c 'output: c'8 c'16 c'

+3


source to share


1 answer


The documents LilyPond you can find this example:

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

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

      



enter image description here

Hope you can adapt to what you want! Replace the rhythm of Mars with yours. Note that $p

space is required between the variable and the duration.

+4


source







All Articles