[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Scheme function help
From: |
Phil Holmes |
Subject: |
Re: Scheme function help |
Date: |
Sun, 15 Jun 2014 18:17:34 +0100 |
----- Original Message -----
From: "David Kastrup" <address@hidden>
To: "Phil Holmes" <address@hidden>
Cc: <address@hidden>
Sent: Sunday, June 15, 2014 4:34 PM
Subject: Re: Scheme function help
Phil Holmes <address@hidden> writes:
I'm not top posting
I'm typesetting quite a bit of mensural music, and using the same music
source for both mensural and modern. The mensural rests tend to be
pitched and the modern ones aren't. So I often have to use the following
as input:
\tag #'mens { f2 \rest } \tag #'mod { r2 }
and then I typeset the mensural version with \keepWithTag #'mens. I
thought it would be easier if I could have a music function that would
emit the tagged version from a function call; something like:
\menrest { f2 }
would provide the output shown above. I'm falling at the first hurdle of
getting the pitched rest:
menrest = #(define-music-function
(parser location noteval )
(ly:music?)
#{
\tag #'mens { #noteval \rest } \tag #'mod { #noteval }
#})
gives the error "unexpected \rest". And of course the second expression
only gives the note currently.
Could anyone point out the way forward, please?
Perhaps something like
--------------------------------------------------------------------------------
menrest = #(define-music-function (parser location note)
(ly:music?)
#{
\tag #'mens $(make-music 'RestEvent note)
\tag #'mod $(make-music 'RestEvent note 'pitch '())
#})
\displayLilyMusic \menrest f2
Thanks, David. Appreciated as ever.
--
Phil Holmes