I'm working on a song with a repetitive rhythm that changes pitch. As this would normally involve a large amount of repeated typing, so I would like to define a LilyPond function to do this for me.
I'm completely lost on how to change the note duration (I figured out the argument for a pitch, but have yet to figure out how to add the duration in the function body, considering that *
seems to register as invalid syntax, and plain numbers are interpreted as part of the variable name). And, I can only get it to return one note at a time.
Repeating the note variable in the function body as shown below does nothing (this is expected, as Scheme seems to implicitly return only the last value in the function)
Is there any way to get a function like this to work?
Alternatively, is there a way to multiply notes in the same way as measure-long rests are multiplied (R1*n
)?
My attempts:
Trying to return multiple values (tried without commas first)
pattern_one = #(define-music-function
(parser location note)
(ly:music?)
note, note, note, note, note, note)
Trying to return list:
pattern_one = #(define-music-function
(parser location note)
(ly:music?)
(note, note, note, note, note, note))
Using LilyPond syntax (this worked, but transposed the entire group of notes up one octave per call to note
, and still leaves the problem of duration):
pattern_one = #(define-music-function
(parser location note)
(ly:music?)
#{
#note #note #note #note #note #note #note
#})
What I want to happen:
Input: d,
Output: d8 d8 d8 d8 d8 d8
or (preferably): d4 d8 d8 d8 d8 d8 d8