lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Create a macro for doubling the note in an arpeggio pattern


From: Lukas-Fabian Moser
Subject: Re: Create a macro for doubling the note in an arpeggio pattern
Date: Fri, 22 Feb 2019 19:38:47 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0


I’m working on a score that has a lot of arpeggios where the first note of the 6-note group of 16th notes is doubled as a dotted 4th note. Having a macro/function to turn e.g. the pattern "f16 c a f c f,” into “<< { f4. } \\ { f16 c a f c f, } >>”, or even more preferably “<< { f4. } \\ { f16([ c a f c f,)] } >>” would save me a lot of typing and trouble. 

What I’ve been tinkering around with is something like:

GR = #(define-music-function (parser location p1 p2 p3 p4 p5 p6)
        (ly:music? ly:music? ly:music? ly:music? ly:music? ly:music?)
        #{
          <<
            {$p1}
            \\
            {$p1 $p2 $p3 $p4 $p5 $p6}
          >>
        #})

\GR f16 c a f c f,

Some spaces already help:

GR = #(define-music-function (parser location p1 p2 p3 p4 p5 p6)
        (ly:music? ly:music? ly:music? ly:music? ly:music? ly:music?)
        #{
          <<
            { $p1 }
            \\
            { $p1 $p2 $p3 $p4 $p5 $p6  }
          >>
        #})

works (at least in 2.19.82).

It's not quite as easy to add articulations, beams and so on. To do so, it's easier if you make the function expect not music but only pitches. (This is necessary anyway since you want p1 taken twice with different duration.)

This leads to:

GR = #(define-music-function (parser location p1 p2 p3 p4 p5 p6)
        (ly:pitch? ly:pitch? ly:pitch? ly:pitch? ly:pitch? ly:pitch?)
        #{
          <<
            $p1 4.
            \\
            { $p1 16[( $p2 $p3 $p4 $p5 $p6 ])  }
          >>
        #})

\GR f c a f c f,

Lukas

PS. I highly recommend using the current "unstable" version if possible; lots of people here on this list use this heavily on a day-to-day basis, enjoying lots of new features and never experiencing trouble. For instance, you may now omit the "parser" and "location" arguments.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]