lilypond-user
[Top][All Lists]

## \goto for Lilypond

 From: Jérôme Plût Subject: \goto for Lilypond Date: Thu, 8 Nov 2018 15:35:18 +0100 User-agent: Mutt/1.5.23 (2014-03-12)

I quite often find myself transcribing a part of a big orchestral
score from IMSLP (e.g., putting the horns in F
transposition and the trombones in bass clef -- our brass section is
not too good at exotic sightreading).

For this I put the global structure of a movement in a \global
variable, such as:

global = {
\time 4/4 \tempo "Al dente ma non troppo"
s1*47 \mark "A" % bar 48
s1*38 \mark "B" % bar 86
...
}

and cues in another variable:

cues = {
% I don't know about you, but I like having *a lot* of cues to
% follow. I suspect that being a former pianist, I find it easier
% than most brass colleagues to read several lines at once?
R1*15 % bar 16
\relative { fis'1^"Fl." } % bar 17
R1*24
\relative { c''1^"Ob." } % bar 41
}

Keeping tracks of the bar numbers is a bit tedious, and I find myself
doing a *lot* of additions/subtractions (« sooo this oboe cue is 7
bars before A, and my last cue ended at bar 17, which makes it, let's
see.. 17 measures of rest »). And then spend twice as long fixing the
bugs (and introducing new ones, etc.)

So I wrote a few macros to automate this (and I expect them to pay
for themselves in only 1-2 more symphonies).

Now I can write the previous score in this way:

global = {
\at-bar 1 { \time 4/4 \tempo "..." }
\at-bar 48 { \mark "A" }
\at-bar 86 { \mark "B" }
}

cues = <<
\relative { \goto 16 fis'1^"Fl." }
\relative { \goto "A-7" c''1^"Ob." } % we can even make them relative
>>

(In particular, this makes *inserting* a new cue much, much easier).

The functions should work even in the presence of varying time
signatures. A proof of concept (in 608 parentheses) is in the attached file.

Drawbacks (those identified for now):
- \partial is not recognized yet
(but this is quite easy to compensate for, by putting the
appropriate skip at the beginning of \global);
- this assumes that alternateBarNumbering is 'numbers-with-letters,
(the other way around is quite easier; I could put some code to
identify \set Score.alternateBarNumbering commands);
- it *does not work* (for syntax reasons) in the presence of true
repeats (they must be simulated using Score.repeatCommands);
- when a voice uses \at-bar, it must *only* use \at-bar (this is the
only way to keep track of time; see my previous question).

Oh, and by the way, I have a half-serious bug-report:
negative-length skips don't work.

--
Jérôme


at-bar.ly
Description: Text Data