# LilyPond’s Look & Feel

As described in the introductory essay on its website LilyPond is modeled after classical plate-engraved scores. This deeply influences the way how LilyPond “thinks” about laying out objects on a virtual paper, but it also results in a characteristic “Look & Feel” that makes music engraved with LilyPond stand apart.

However, while this default appearance is undisputedly of high quality it is (of course) not to everybody’s pleasure, and it can be considered a rather severe limitation that the Emmentaler notation font is so deeply interwoven into LilyPond itself that it can’t easily be replaced with other fonts matching different styles.

But wait a minute: Did I say “it is a limitation”? Well, I have to stand corrected: It was a limitation, and this limitation has gone now! Continue reading

# 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.

# 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.

# 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)

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)

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)

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 }
}

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

# The Pleasantry of LilyPonding

Sometimes I wonder why I work with LilyPond. Often it means investing many tedious hours in music typesetting, and any given small issue can take a lot of time and deep research to solve. Yet I still use LilyPond, and I love it. But why? 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