[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Arguments before functions
From: |
Fr. Samuel Springuel |
Subject: |
Re: Arguments before functions |
Date: |
Mon, 20 Jul 2020 10:29:39 -0400 |
> On 19 Jul, 2020, at 4:32 PM, David Kastrup <dak@gnu.org> wrote:
>
> I don't see that you can fix this with a music function,
That’s what I thought, I just wanted to make sure.
> but of course
> you can process the complete music expression and then modify any note
> before a \bar "|".
I hadn’t thought of that, but since it would still involve modifications to the
source (to add the function which modifies the whole source) I figure I’m
probably better off with functions that only affect the notes I’m interested in
changing in the long run.
> On 19 Jul, 2020, at 4:43 PM, Aaron Hill <lilypond@hillvisions.com> wrote:
>
> Rather than try to work around the plumbing of LilyPond, might I suggest the
> following:
>
> %%%%
> ...
> %%%%
>
> This approach allows you to create a template of sorts for individual notes.
> Above is an example usage to aid with pointing, supporting the middle of a
> phrase and the final tone.
Interesting approach. My idea was to define functions which apply the
transformations directly and then have place holder functions in the music
which are defined using \etc:
%%%%
\version "2.20.0"
episema = #(define-music-function (note-event) (ly:music?)
"Add an tenuto ArticulationEvent to the articulations of
`note-event',
which is supposed to be a NoteEvent expression. This simulates
the
episema."
(set! (ly:music-property note-event 'articulations)
(cons (make-music 'ArticulationEvent
'articulation-type "tenuto")
(ly:music-property note-event 'articulations)))
note-event)
dotted = #(define-music-function (note) (ly:music?)
"Add a dot to the duration of note."
(withMusicProperty 'duration (ly:make-duration 2 1) note)
)
final = \dotted \etc
middle = \episema \etc
\fixed c' { \cadenzaOn a4 g \middle b g8[ f] g4_( \final c') \bar "|” }
%%%%
In this case switching what appears in the music is a matter of changing the
definitions of the aliases.
I think both approaches accomplish the job, so it’s probably a matter of taste
as to which to choose. Yours does have the distinct advantage of making more
use of LilyPond syntax and is more compact as a result.
✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝
Fr. Samuel, OSB
(R. Padraic Springuel)
St. Anselm’s Abbey
4501 South Dakota Ave, NE
Washington, DC, 20017
202-269-2300
(c) 202-853-7036
PAX ☧ ΧΡΙΣΤΟΣ