On 22/01/2023 18:31, Jean Abou Samra wrote: > Le 22/01/2023 à 18:22, Darren Ng a écrit : >> Thanks. The following works: >> >> accOne = >> #(define-music-function >> (x ) >> (ly:pitch?) >> #{ >> $x 8 $x 8 >> #}) >> >> My ultimate goal is a function which does the following >> >> accTwo = >> #(define-music-function >> (x ) >> (ly:pitch?) >> #{ >> $x 8 r8 >> <($x+4) ($x+7)>8 r8 >> ($x-5) 8 r8 >> <($x+4) ($x+7)>8 r8 >> #}) >> >> E.g. >> >> \accTwo c expands to { c8r8 <eg>8r8 g,8r8 <eg>8r8 } >> \accTwo f expands to { f8r8 <ac'>8r8 c8r8 <ac'>8r8 } >> >> What material should I read so that I'll be able to achieve this? > > > Spoiler: you can do that with just > > \version "2.24.0" > > accTwo = > #(define-music-function > (x ) > (ly:pitch?) > #{ > $x 8 > r8 > <\transpose c e $x \transpose c g $x >8 > r8 > <\transpose c g, $x >8 r8 > <\transpose c e $x \transpose c g $x >8 > r8 > #}) > > \accTwo c'
Not sure why I didn't think of this much simpler solution a week ago: \version "2.24.0" accTwo = #(define-music-function (x) (ly:pitch?) #{ \transpose c $x { c8 r <e g> r g, r <e g> r } #}) \accTwo c' Jean
OpenPGP_signature
Description: OpenPGP digital signature