How to write readable tuplets

All notation programs aim of course at being as powerful a tool as possible to help composers, arrangers and engravers rather than hold them back. I’d like to explore an area where I think you have to use these powers with care – I’m talking about tuplets.

This article is written from the perspective of writing music in LilyPond (this is after all the LilyPond blog) but my aim is that anyone interested in music notation should be able to follow this.

Tuplets in LilyPond

Most readers of this blog would of course already know that as of LilyPond 2.17.x the syntax for writing a tuplet is this:

\tuplet fraction { music }

Those who aren’t familiar with LilyPond will note that it is text-based, and that ‘writing’ music here is more literal than in more graphical programs. Here’s an example with an ordinary triplet:

\tuplet 3/2 { g8 a b }

tupl-ex1
As a side note I personally think that tuplets are an area where the text-based model really is an advantage. I’d like to illustrate this by showing how easy it is to make a nested tuplet. Here is the last triplet quarter substituted with another triplet:

\tuplet 3/2 {
    g4 a
    \tuplet 3/2 { g8 a b }
  } g2

tupl-ex2
In my experience though the real advantage comes when you have to edit an already created tuplet.

Readable tuplets?

Different notation programs may have small restrictions for what is possible but I think it can be assumed that the aim is to make notation as easy as writing with pen and paper, so in theory the only impediments are limited imagination and rhythmical miscalculations. But where this can make life easy for the person who writes the music it can make life hard on the person who is to perform it. When we are talking about nested tuplets that is of course very complex. But also single tuplets can be somewhat overpowering.

It should be noted that LilyPond and other notation programs don’t prevent the user from creating tuplets that are ambiguous or even totally misleading, just as they don’t prevent the user from bad notation in general – the more flexible and powerful the program, the more responsibility for the user. Hence you should always seek to follow notational practices to facilitate the interpretation of the score.

Unfortunately for tuplets the situation is even more complex because of there being two conventions regarding their notation that are somewhat competing:

The mathematical rule

The first rule regarding tuplet notation is slightly mathematical. It says that if you calculate the tuplet fraction the result should always be between 1 and 2. (For those of you who would like an even more mathematical definition this could be stated as: 1 < Tf < 2 where Tf is the tuplet fraction.)

To further explain this rule and its rationale I would like to start with the fraction 3/4 (= 0.75 < 1), which is disallowed by the rule. Why is that? Let’s look at this example:

\tuplet 3/4 { g8 a b } d4 e

tupl-ex3
We have three 8ths in the space of four 8ths and then we have 2 ordinary quarters just like we prescribed. But this looks completely wrong. And that is of course because we have a very strong convention that three 8ths as a tuplet/triplet equals a quarter and not a half. Thus we normally would obey the mathematical rule, in the case of triplets at least. We would instead use the fraction 3/2, which is allowed by the rule (1 < 3/2 = 1.5 < 2). It would look like this:

\tuplet 3/2 { g4 a b } d4 e

tupl-ex4
It could again be noted that although the first example is very misleading and would take some attention to figure out, it would not result in any error or warning from LilyPond. And I don’t think it should, it should be up to the user to think of readability and proper notation. Furthermore a composer could have a very good reason to choose a non-standard notation and should be allowed to do so.

What happens on the other end, when the fraction is greater than 2? With this rule e.g. the fraction 5/2 (= 2.5 > 2) isn’t allowed. Let’s again look at an example:

\tuplet 5/2 { g8 a b c d } c2.

tupl-ex5
Here again it looks wrong; it seems very strange to put as many as five 8ths in the duration of a quarter and we can just as easily as in the previous example see the rationale for the rule. Here the duration of the five 8ths should take up a half, as in this example:

\tuplet 5/4 { g8 a b c d } c2

tupl-ex6
To conclude before moving to the next rule, this rule should be fairly easy to follow, and it’s actually what I would prefer and even recommend.

The nearness rule

Now for the second rule. Let’s begin with this example:

\tuplet 7/4 { g8 a b c d e f } e2

tupl-ex7
This follows the first rule. But in the same space as the seven tuplet 8ths we could fit eight 16ths and only 4 regular 8ths. Isn’t it then more intuitive to use 16th notes for this instead?

\tuplet 7/8 { g16 a b c d e f } e2

tupl-ex8
No, I don’t really think so and this wouldn’t be allowed by the first rule, because the fraction is less than 1. But the supporters of the second rule would say that this is the way to do it. The second rule could roughly be stated as saying simply that tuplets should mimic the regular note values as closely as possible, thus I call it the “nearness rule”.

I think it’s important to note that this second rule is less definite than the first. It isn’t hard to find examples where you couldn’t absolutely settle what the rule would recommend. Take for instance the previous example of 3/4 — this is as close to regular note values as 3/2 but the general convention would definitely rule it out. On the other hand, even if this practice of 3/2 is not fully sanctioned by the second rule it is definitely not contradictory to it.

Maybe it’s too hard on this practice of seeking the nearness relation to require it to give a definite answer in every instance. Maybe it’s even misleading to call it a rule. I guess it’s on a more intuitive level when you choose the notation which is nearest to the standard division.

Must I follow a rule?

To write music in a notational software is of course not more flexible than to write music with pen and paper. But with tuplets at least I think the software invokes the idea that the flexibility which is allowed by the program is also a flexibility I have as a creator. When writing with pen and paper you get a better sense of having to create the boundaries yourself. (This is my own experience anyway.)

I think I have shown that it is possible to construct examples which are fully possible to conceive and create but which run counter to our normal idea of how tuplets should be notated and interpreted. But I have also explained that the consensus isn’t clear in detail on how to notate tuplets. Isn’t it then more important to make the notation distinct and unambiguous (for example by clearly stating the ratio) than to follow these competing rules?

Let’s go back to the previously discussed ratio 3/4, here’s the example again with explicit ratio and additionally the explicit note value of the denominator:

\once \override TupletNumber.text =
    #(tuplet-number::append-note-wrapper
      tuplet-number::calc-fraction-text "8")
  \tuplet 3/4 { g8 a b } d4 e

expl-ratio
Now this notation should be clear – it’s three 8ths replacing four 8ths; although unusual, it’s now also unambiguous.

If you have good reasons to create a non-standard tuplet it’s of course advisable to make it clear in this way. But I think the ability to make yourself clear should not be taken as an excuse for arbitrarily breaking the conventions that after all exist.

It’s equally easy to write 3/4 as 3/2 but the former will require a clarification and hence a greater effort from both you and your reader. So the choice should be obvious for most cases.

Again, this is not an argument against using the more explicit notation of the tuplet ratio to make it clearer. There are of course cases where it instead increases the effort of the reader. It could be noted that Gould in Behind Bars recommends indicating ratios in full when using the nearest rule in a way that contradicts the mathematical rule (which she, like me, thinks is clearer).

Conclusions

Creating tuplets in LilyPond and other notation software is very flexible and powerful, but you as a user should be careful not to misuse these powers. We have seen that currently there are two conventions on how to notate tuplets and that LilyPond in these examples isn’t taking a side between these two views, and as long as these two conventions exists side by side she should not do that. But you as a music writer should definitely take a side and only use one of the conventions at the time. Otherwise it could potentially be very confusing for the reader and performer of the music you write.

My main point here is not to restrict the use of tuplets (they are part of our musical language), but when they are used they should be notated carefully in order not to unnecessarily increase the complexity. Don’t trust the software to do the thinking for you — take those conventions that exists into account and if you want to go beyond then use the possibility of making the notation more explicit.

What do you think? Please share your thoughts in a comment!

References:

Elaine Gould – Behind Bars (London, Faber Music Ltd, 2011)
Gardner Read – Modern Rhythmic Notation (London, Victor Gollancz Ltd, 1980)

Towards templating with la-lily-pond

In my previous post “Trees, Music and Lilypond”, I introduced a hierarchical naming scheme to store music in a structured manner and then to use template functions on it. Now I will explain how template functions can also be organized hierarchically (in a tree) and “normalized,” and what benefit we gain from this. In short, this is an effective way to separate different tasks — storing the music (content) is one task and laying it out in a score (presentation) is another. While I was previously writing about the theory grounding this technique, I will now shift these ideas towards the actual implementation and the main goals of this approach. Continue reading

Trees, Music and Lilypond

In this post I write about some hierarchical aspects of typesetting music with LilyPond. In a way the elements that form a musical score can be split into pieces that stand in a hierarchical relation. We can make use of this relationship to do interesting stuff such as creating templates and injecting tweaks into a score without touching the music source itself. For my personal use I have developed several tools that help me manage my projects in a structured manner. Recently I made them publicly available and today I’ll start introducing them on this blog. This first post is about the theory behind the implementation which I will describe in following articles. Continue reading

What You “Miss” When Using Version Control

Recently I stumbled over this list about “How I save documents” – it’s German but you’ll surely get the point.

It is meant to be funny, but actually it’s a comprehensive documentation of one of the reasons why using plain text and version control rocks. When presented with this list scholars or other people usually respond with telling sighs of recognition – while my personal recognition has actually faded away and has to be actively pulled from a very distant past ;-)

I realized that while having written so much about version control on Scores Of Beauty we don’t have an article yet telling you concisely why you should use it as your bread-and-butter tool for daily work. So today I’m going to give you a list of things you will miss and eventually forget when you switch your toolkit to using version control.
Continue reading

Slur shapes and transposed parts: Use tags!

Many contemporary music scores are engraved in concert pitch for easier reading. Parts for transposing instruments must (obviously) be transposed. This may cause slurs and ties to be shaped differently between the score and the parts. In most cases, LilyPond’s d default slur and tie positioning will be attractive enough. If so, there’s no particular problem: LilyPond will calculate the slur/tie shape based on the notes actually being processed at the time.

It does present a problem if the default shape needs to be modified using the \shape command. \shape specifies the alteration in terms of moving the Bezier curve’s control points away from their default positions:

\shape #'((dx0 . dy0) (dx1 . dy1) (dx2 . dy2) (dx3 . dy3)) Slur

To make a downward slur deeper, for instance, you would push the
middle control points down:

\shape #'((0 . 0) (0 . -1) (0 . -1) (0 . 0)) Slur

If transposition should cause the slur to flip upward, this modification will flatten the curve instead. This is quite likely to look wrong, perhaps even unreadable.

I recently ran into this problem in one bar of a trio d’anches that I’m close to finishing. This bar contains a melodic phrase that spans 2.5 octaves in the space of five notes before leaping down a major tenth, under a slur. (Note that the notes themselves are contained in a music variable, and the score only refers to the variable. This is standard practice for any LilyPond project where a score and parts must be generated. It makes it possible to enter the notes once, and lay them out in a score or in parts as needed.)

music = \relative c' {
  \tupletSpan 1*6/8
  \tuplet 4/3 {
    cis4 f,! ( d' e cis' b'2 g,4 )
  }
  \tupletSpan \default
}

{ \time 12/8 \music }
(click to enlarge)

(click to enlarge)

The slur is pretty close, although it makes me a little physically uncomfortable to look at it. There is not enough space above the B, and the shape also disguises the sharp downward leap in the last note.

To fix it, push the third control point up (positive Y offset), and the last control point down.

music = \relative c' {
  \tupletSpan 1*6/8
  \tuplet 4/3 {
    cis4
    \shape #'((0 . 0) (0 . 0) (0 . 1.2) (0 . -0.5)) Slur
    f,! ( d' e cis' b'2 g,4 )
  }
  \tupletSpan \default
}

{ \time 12/8 \music }
(click to enlarge)

(click to enlarge)

What happens if we use that music in a transposed part, however?

music = \relative c' {
  \tupletSpan 1*6/8
  \tuplet 4/3 {
    cis4
    \shape #'((0 . 0) (0 . 0) (0 . 1.2) (0 . -0.5)) Slur
    f,! ( d' e cis' b'2 g,4 )
  }
  \tupletSpan \default
}

{ \time 12/8 \transpose a c' \music }
(click to enlarge)

(click to enlarge)

Now, the slur begins below the top of the stem and just to the right, and it ends quite a bit closer to the notehead than the concert-pitch version. These differences mean that the default curve for A clarinet is much more pronounced. The \shape alteration for concert pitch increases the curvature even further, making the transposed slur look exceptionally “loopy.”

So we need more curvature than the default for concert pitch, and less curvature of the transposed part.

But, in the \shape examples in the LilyPond manuals, it appears that \shape must appear right before the note that initiates the slur or tie to be affected. That is, in normal usage, you can have only one \shape per slur or tie. In this case, the music variable needs to specify both shape modifications, and the music expression that uses the variable should be able to choose which one to use at the time of engraving.

LilyPond has a mechanism to choose between versions of some content: tags. A portion of music (a music expression) can be enclosed in curly braces and associated with a name using the \tag command. If the music variable is used without any tag references, all of the tagged expressions will be kept. Other commands, \keepWithTag and \removeWithTag, can cause certain tagged expressions to be ignored.

music = { \tag #'tagName { ... music expression ... } }

% Elsewhere, in the score
\keepWithTag #'tagName \music

It might not seem to apply to this case, because most uses of \tag will include real music in the expression. Here, all the notes are the same; it would be redundant to put notes inside the tags. Ideally, the tags would include only the content that is different: namely, the \shape alterations. But is that legal? Will it break the \shape calls to put them inside a tag, while the slur itself is outside?

In fact, it is legal. \shape inserts \once \override commands into the expression. These are considered “music,” and may legally appear alone in a tagged expression. The final expression that LilyPond renders includes the override, followed immediately by the slur to affect: no problem.

So the surprisingly simple solution is to write both \shape alterations, each with a different \tag. Then, use \keepWithTag or \removeWithTag to choose which of the \shape calls will be used in this context.

music = \relative c' {
  \tupletSpan 1*6/8
  \tuplet 4/3 {
    cis4
    \tag #'scoreOnly { \shape #'((0 . 0) (0 . 0) (0 . 1.2) (0 . -0.5)) Slur }
    \tag #'partOnly { \shape #'((-0.5 . 1.5) (0 . 0) (0 . 0) (0 . 1.0)) Slur }
    f,! ( d' e cis' b'2 g,4 )
  }
  \tupletSpan \default
}

\markup \bold "Score in concert pitch"
\score {
  \new Staff { \time 12/8 \keepWithTag #'scoreOnly \music }
}

\markup \column { \vspace #1 \bold "Part, transposed for clarinet in A" }
\score {
  \new Staff { \time 12/8 \transpose a c' \keepWithTag #'partOnly \music }
}

example-5.preview

More on tags: Using tags

More on shape: Modifying shapes

Polymetrics in Sibelius (vs. LilyPond)

Recently I published an article about polymetric notation to demonstrate how LilyPond provides easy solutions for desires that Finale leaves unfulfilled. Now I got some excerpts from the Sibelius manual showing how that program deals with the task of polymetric notation, and I think this is a good opportunity to have a look at the different approaches to this topic. Continue reading

The Ring Closes

Oh my, it has been more than a month without anything new on Scores of Beauty – what a shame. OK, we haven’t been lazy in the meantime, but there simply hasn’t been the time to squeeze anything in that could be shared publicly. Maybe I’ll find the time to report about my participation in a conference on “Digital Music Edition” at the university of Berne earlier this month, but for now you’ll have to do with today’s little post about two rings. Continue reading

Les fonctions musicales 4. La récursivité

Traduction d’un article de Urs Liska

Nous conclurons aujourd’hui cette série d’articles sur les fonctions musicales avec LilyPond. J’ai pris soin de prendre mon temps dans les explications, parce que c’est justement ce qui manque à la documentation de Lilypond – par ailleurs excellente. Disons qu’en son temps, j’aurais aimé avoir ce genre d’explications…

Dans le premier article, nous avons vu comment insérer une fonction musicale dans les fichiers source LilyPond. Dans le second, nous avons commencé à écrire une fonction qui colorie une expression musicale donnée avec une couleur de notre choix, en ayant toutefois pratiqué du codage en dur et beaucoup de redondance. Le troisième article a été l’occasion d’aborder la factorisation et l’utilisation des listes. Nous n’avons pas pu atteindre notre but comme souhaité, ce qui sera fait dans ce quatrième article. Continue reading

Les fonctions musicales 3. Du code réutilisable

Traduction d’un article de Urs Liska

Dans l’article précédent, nous avons écrit une fonction permettant de coloriser une expression musicale avec différentes couleurs choisies. Nous avons pointé du doigt le problème suivant : nous devions modifier chaque propriété manuellement – et d’ailleurs nous n’avons pas pu les identifier toutes. En répétant la fonction \override, nous avons commis des redondances qui vont à l’encontre des bonnes pratiques de programmation. Aujourd’hui, nous allons faire beaucoup mieux et
apprendre à créer du code réutilisable en factorisant et en utilisant des opérations sur les listes. Continue reading