lilypond-user
[Top][All Lists]

## Macro with

 From: David Menéndez Hurtado Subject: Macro with Date: Thu, 14 Nov 2019 10:02:16 +0100

I am transcribing a piece that is filled with the rhythmic motif "8. 16 8" at different pitches. Being a LaTeX user, I want to write a macro like \myrithm{c a g}. I found the documentation for Scheme functions, and how to edit whole music sections, but nothing on how to insert a fixed number of pitches. As I understand it, ly:music is an arbitrary music _expression_, so I cannot restrict it to just three pitches.

This is what I managed to put together, but doesn't quite work. Anyone can suggest how to fix it?

/David.

\version "2.19.83"
\language "english"

myrithm =
#(define-music-function
(parser location first second third)
(first second third)
(ly:pitch? ly:pitch? ly:pitch?)
#{
#first 8. #second 16 #third 8
#})

\score {
<<
%\new Staff {\relative do' {\myrithm{c, d, e}}}
\new Staff  {\time 6/8 \relative c' {c4. c \myrithm a' b e  \myrithm {e d c} c c c }} %Two different ways of calling it, neither works.
>>
\layout {
}
}