lilypond-user
[Top][All Lists]
Advanced

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

Intended use of the empty chord <> construct


From: Trevor Bača
Subject: Intended use of the empty chord <> construct
Date: Tue, 1 May 2018 17:47:01 -0500

Hi,

I recently discovered the empty chord <> construct. From some initial tests, it looks like <> might solve a small handful of very difficult spanner-termination cases I've been wrestling with for years.

Before I go further, I'd like to check my understanding of <> and how it works:


1. Is <> documented somewhere that I'm missing? There's a passing reference at the bottom of 1.2.2 Writing rests (concerning the positioning of text just prior to the start of multimeasure rests). But a much more helpful bit is buried in the regression tests here:

http://lilypond.org/doc/v2.19/input/regression/03/lily-45f9f512.ly

(That bit above was a real revelation for me.) Am I missing a full(er) explanation of <> elsewhere in the docs?


[2. For the developers: is <> intended to remain a part of LilyPond distributions for the longterm, ie, on the order of years? I assume the answer is yes, but I want to check, given the low profile of the construct in the docs.]


3. This is the important one: is it notionally correct to think of <> as providing something like "an 'anchor' (for articulations and spanner endpoints) **on the next event to come** ... without knowing what that event will be"?


The summary in #3 seems to be what my tests are showing me. But given that <> appears, somehow, to format symbols at a just-future point beyond the current moment *while also NOT advancing musical time*, I want to make sure I'm not missing something obvious. No other LilyPond construct would appear to behave quite this same way.

The rest of this mail can be skipped (unless you're as interested in the minutiae of spanner endpoints as I am).

* * *

Here's an example of one of the spanner-termination cases I mentioned at the start of this mail.

Variables are great for externalizing chunks of music, like in example #1:


%%% BEGIN EXAMPLE #1 %%%

\version "2.19.80"

musicA = {
    a'4 \startTrillSpan
    a' \stopTrillSpan
}

musicB = {
    b'4
    b'
}

\new Staff {
    \set Score.proportionalNotationDuration = #(ly:make-moment 1 12)
    \musicA
    \musicB
}

%%% END EXAMPLE #1 %%%

But note the endpoint of the trill. Due to a peculiarity of how LilyPond's trill spanner works, music enclosed in \startTrillSpan and \stopTrillSpan commands renders such that the trill spanner does *not* appear above all of the music in question (the two As here). Rather, such music is rendered with the trill spanner appearing above the all-but-last elements in the music, as the output shows.

Though this particular behavior of the trill spanner has always seemed deeply counterintuitive to me, in practice it's rarely a problem: just move the \stopTrillSpan command down one note / rest / chord past where you want it. (Though, of course, this leads precisely to the perennial problem of what to do with spanners and especially hairpins that end *after the last note* of a piece, a problem that the various to-barline implementations seem designed to address.)

But how to do this when externalizing chunks of music in variables, as in the example? The spanner in example #1 is too short.


Something like example #2 does the trick (and is syntactic). Though perhaps a bit weird:

%%% BEGIN EXAMPLE #2 %%%

\version "2.19.80"

musicA = {
    a'4 \startTrillSpan
    a'
}

musicB = {
    b'4 \stopTrillSpan
    b'
}

\new Staff {
    \set Score.proportionalNotationDuration = #(ly:make-moment 1 12)
    \musicA
    \musicB
}

%%% END EXAMPLE #2 %%%

The notational output in example #2 is what I'm looking for: the trill spanner is now long enough.

But I can't be the only one who finds separating matching \startTrillSpan and \stopTrillSpan commands *across variables* to be at least inelegant: the (hoped for) meaning of the first variable should be something like "two As with a trill spanner written above both of them." But that musical idea seems impossible to encode as-is; it would seem that the second variable has to be modified as shown above, to carry a non-semantic \stopTrillSpan at its opening.

(I should hasten to add here that I understand that different users can construe semanticity differently here: if you think of externalized variables in LilyPond as straightforward cases of lexical substitution, then separating matching commands across variable boundaries probably doesn't look very weird.)

However, the empty chord <> construct appears to allow for a fully semantic way of encoding exactly what I'm looking for:

%%%  BEGIN EXAMPLE #3 %%%

\version "2.19.80"

musicA = {
    a'4 \startTrillSpan
    a'
    <> \stopTrillSpan
}

musicB = {
    b'4
    b'
}

\new Staff {
    \set Score.proportionalNotationDuration = #(ly:make-moment 1 12)
    \musicA
    \musicB
}

%%% END EXAMPLE #3 %%%

(The output is the same as #2.)

To me, this is like magic: the empty chord <> appears to afford the ability to say "here's a chunk of music of two As with a trill spanner covering both" by appealing to the notional understanding I introduced at the top of this mail: the empty chord functions as an 'anchor-yet-to-come' to which the trill's endpoint can attach *even without knowing what that upcoming note / rest / chord is going to be*.

I hope somebody else finds this (admitted corner case of a use) as special as I do. And, hopefully, I'm not misusing the purpose of the <> construct in setting up externalized variables in this way.

Trevor.


--

reply via email to

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