The LilyPond Snippet Repository ♪♫

What's this? Searching the LSR Browse by date Contributing Snippet database Browsing items 852−939 out of 940

Time signature with alternate in parentheses

In polymetric music, a composer may indicate beat structure by following one time signature with another in parenthesis, for example: 3/4 (6/8) indicating a 6/8 beat in a 3/4 measure, or 6/4 (6/8) indicating a 6/8 beat in a 6/4 measure. This snippet is derived from the parenthesize-time snippet, adding an unparenthesized fraction in front of the parenthesized one.

Time signature with alternate in parentheses

Time signature with note in denominator

To change the time signature from 3/2 to 3/(half note), override the 'stencil property to allow markup.

Time signature with note in denominator

Time signatures

Time signature indicates the metrum of a piece: a regular pattern of strong and weak beats. It is denoted by a fraction at the start of the staff.

The time signature is set with the \time command

Time signatures

Time signatures fraction style for 4/4 and 2/2

The symbol of the time signature can be customized with the style property. Setting it to #'() uses fraction style for 4/4 and 2/2 time.

Time signatures fraction style for 4/4 and 2/2

Time Signatures on top of the score using a separate staff

In 20th century music, where time signatures tend to change a lot, it is sometimes recommended to put the time signatures on top of the score (or above each StaffGroup in the case of an orchestral score). This can be achieved by creating a dummy staff which only contains the Time_signature_engraver.

In this specific example, a separate identifier is used to define every time signature change, which saves the bother of entering them again when typing the actual music (careful though: it makes getting lost easier!).

Notice the overriding of the X-offset property: a specific trick to make the time signatures align with the barlines, thanks to Han-Wen.

Time Signatures on top of the score using a separate staff

Toc Section Command

If you have several pieces in several files, you might want to build a book from that. Assume you have a master file which includes the pieces:

\include "tune1.ly"
\include "tune2.ly"

In your piece-files you might have \tocItem commands to build the table of contents.

If you replace those \tocItem commands with the newly defined \part command, you can use #(set-toc-section! "section") in the master file:


#(set-toc-section! "tunes")
\include "tune1.ly"
\include "tune2.ly"
#(set-toc-section! "parts")
\include "part1.ly"
\include "part2.ly"
Now every section is introduced with a section line in the table of contents only if the section title was set before. If you reorder the parts (includes), the sections will still appear in the right place. This is meant for compiling a collection of pieces, which also compile themselves. For a complete opus with pieces Please see snippet 368

Toc Section Command

Tramlines and Feta font caesurae

This snippet shows a way to insert available Feta font symbols as caesurae and ways to create tramlines. Normally a caesura is indicated by a pair of oblique lines lying through the top line of the staff, also called a fetura, tramlines, railroad tracks, or a cut-off. LilyPond provides several alternatives. A stylized version of tramlines is called caesura.

Tramlines and Feta font caesurae

Translating notes from one language to another

To change an input file written in a foreign language to your favorite language use \include "…language….ly" and \displayLilyMusic { \melody }.

The translation is by default written to the log; you can redirect this output to a file of your choice using the command lilypond.exe >yourfile.ly (with windows).

The result of the snippet will be in absolute pitch:

{
  c8 d e f g a b c |
  cflat dflat eflat fflat gflat aflat bflat cflat |
  csharp dsharp esharp fsharp gsharp aflat bsharp csharp |
  \bar "|."
    
}

Translating notes from one language to another

Translating the default LilyPond tagline

You are probably familiar with the default Lilypond tagline Music engraving by LilyPond 2.1x.xx—www.lilypond.org, that is automatically added to your scores.

Not only can you fully remove it, by setting the tagline variable to f (just add tagline = ##f in your header block), but you are also welcome to translate it (and the LilyPond authors invite you to do so if you want to promote this great software) or customize it the way you like it!

In this snippet, we have taken the original tagline definition in the titling-init.ly file, and therefore we can tweak it the way we want. The right version number will automatically be added.

Translating the default LilyPond tagline

Transposing and naming instrument groups

In an orchestral score (Beethoven's Coriolan overture), there are different instrument groups, and some of the instruments may be transposed. Instruments are indicated either with a long or short name.

Transposing and naming instrument groups

Transposing pitched rests

If pitched rests (entered with \rest) are transposed, the \fixRests helper function ensures that rests are not positioned on staff lines

Transposing pitched rests

Transposing pitches with minimum accidentals ("Smart" transpose)

This example uses some Scheme code to enforce enharmonic modifications for notes in order to have the minimum number of accidentals. In this case, the following rules apply:

Double accidentals should be removed

B sharp -> C

E sharp -> F

C flat -> B

F flat -> E

In this manner, the most natural enharmonic notes are chosen.

Transposing pitches with minimum accidentals ("Smart" transpose)

Tremolo slash at the stem midpoint

Some editions place the tremolo slash in the middle of the stem, between the notes. Here is a way to achieve that.

Tremolo slash at the stem midpoint

Tuning the MIDI output in Herz

This snippet can be used to tune the MIDI output so that the A has an arbitrary frequency expressed in Hertz. For example, 440 Hz is the most common tuning, and 415 Hz is a typical baroque tuning.

Tuning the MIDI output in Herz

Tuplet bracket and change staff

This snippet shows how to set a tuplet starting in a lower staff and finishing in the upper one.

Tuplet bracket and change staff

Tuplet-brackets and -numbers always on notehead-side

If you want to place the TupletBracket and the TupletNumber always at the side of the NoteHead, you could use \tupletAtNoteHeads as defined here.

If a kneed Beam occurs, a warning will be printed.

Tuplet-brackets and -numbers always on notehead-side

Turkish Makam example

This template uses the start of a well-known Turkish Saz Semai that is familiar in the repertoire in order to illustrate some of the elements of Turkish music notation.

Turkish Makam example

Tweaking clef properties

Changing the clef glyph, its position, or the ottavation does not change the position of subsequent notes on the staff. To get key signatures on their correct staff lines, middleCClefPosition must also be specified, with positive or negative values moving middle C up or down respectively, relative to the staff's center line.

For example, \clef "treble_8" is equivalent to setting the clefGlyph, clefPosition (the vertical position of the clef itself on the staff), middleCPosition, and clefTransposition. Note that when any of these properties (except middleCPosition) are changed a new clef symbol is printed.

The following examples show the possibilities when setting these properties manually. On the first line, the manual changes preserve the standard relative positioning of clefs and notes, whereas on the second line, they do not.

Tweaking clef properties

Tweaking grace layout within music

The layout of grace expressions can be changed throughout the music using the functions add-grace-property and remove-grace-property.

The following example undefines the Stem direction for this grace, so that stems do not always point up, and changes the default note heads to crosses.

Tweaking grace layout within music

Two \partCombine pairs on one staff

The \partCombine function takes two music expressions each containing a part, and distributes them among four Voices named two, one, solo, and chords depending on when and how the parts are merged into a common voice. The voices output from \partCombine can have their layout properties adjusted in the usual way. Here we define extensions of \partCombine to make it easier to put four voices on a staff.
soprano = { d'4 | cis'  b  e'  d'8 cis' | cis'2 b }
alto = { fis4 | e8 fis gis ais b4 b | b ais fis2 }
tenor = { a8 b | cis' dis' e'4 b8 cis' d'4 | gis cis' dis'2 }
bass = { fis8 gis | a4 gis g fis | eis fis b,2 }

\new Staff <<
  \key b\minor 
  \clef alto
  \partial 4
  \transpose b b'  
  \partCombineUp \soprano \alto
  \partCombineDown \tenor \bass
>>

Two \partCombine pairs on one staff

Two cue voices

By default, LilyPond directs all simultaneous cues into a single voice. Here is a solution that uses two voices for two different cues.

Two cue voices

Typesetting a canon

A canon usually is a single-part melody which has the ability to form a polyphonic music when sung with several voices. To print such a melody, you might want to use the following trick, that allows the barlines to be synchronized between the voices, without making the score look like a multi-stave polyphonic score.

Typesetting a canon

Typesetting glissandi across staves

If you need to notate a glissando going across staves, it is very simple to do so with LilyPond's voice-change functions.

Typesetting glissandi across staves

unfold percent repeats only

If you want to display the same music definition in some situation (e.g. part) with percent repeats, while in other situations (e.g. score) you want to show the percent repeats unfolded, here are some functions to handle this.

unfold percent repeats only

Unfretted headword

Unfretted headword

Unfretted headword

Unusual graphical crescendos (cosmetic Hairpin styles)

By overriding the 'style property of the Hairpin object, you can get nice contemporary crescendos and decrescendos.

Unusual graphical crescendos (cosmetic Hairpin styles)

Use custom font's flat (b) and sharp (#) symbols for chords

For typesetting chords, LilyPond uses its internal accidentals (i.e. it uses glyphs from the Feta font). This example shows how you can change LilyPond's behaviour to use the accidentals "#" and "b" from the currently selected font. This is useful if you'd like to use a font for setting jazz chords in RealBook style.

Use custom font's flat (b) and sharp (#) symbols for chords

Use square bracket at the start of a staff group

The system start delimiter SystemStartSquare can be used by setting it explicitly in a StaffGroup or ChoirStaff context.

Use square bracket at the start of a staff group

User defined time signatures

New time signature styles can be defined. The time signature in the second measure should be upside down in both staves.

User defined time signatures

Using a custom \elseTag command to replace several \tag commands

The purpose of the \elseTag command is to make the use of tagged music easier.

This exemple shows the same music, without and with \elseTag.

In the old manner (first exemple), you have to write all the tag names you want,and to omit only the one you don't want.

In the second exemple, \elseTag exclude automatically the tag you don't want, and keep all the others.

\elseTag has the same syntaxe than \tag and has to be use in conjonction with \keepWithTag.

Using a custom \elseTag command to replace several \tag commands

Using a different rest stencil globally (e.g., printing rests as circles)

Sometimes, an author may want to display rests not with their usual symbols, but e.g. use a circle instead of a quarter rest and a circle with a rectangle below for eighth rests.

This snippet provides a Scheme function for the Rest's #'stencil property, which creates circles instead of the usual rest symbols for quarter and eighth rests, but uses the standard symbols for all other rests. This is done by checking the duration-log property of the rest object and provide a custom stencil for log values of 2 and 3 (because 1/4 = 2-2 and 1/8 = 2-3). For all other values, the built-in rest formatter function is called.

To enable this style only for some parts of a score, don't set the stencil globally, but call the \override somewhere inside the score and \revert it after the section with the custom style:

\relative c' {
  e4. r8 e4 r4
  \override Rest #'stencil = #ly:rest-interface::dot-rests
  e4. r8 e4 r4
  \revert Rest #'stencil
  e4. r8 e4 r4
}

To enable this style globally, simply override the #'stencil property of the Rest object in a layout block:

\layout {
  \context {
    \Voice
    \override Rest #'stencil = #ly:rest-interface::dot-rests
  }
}

Using a different rest stencil globally (e.g., printing rests as circles)

Using a percent repeat with plainchant

To use a single percent repeat for plainchant, override the stencil for a multi-measure rest and align the chant lyrics to a hidden note.

Note that multi-measure rests are incompatible with cadenza timing, so normal timing should be enabled for the duration of the rest.

Using a percent repeat with plainchant

Using a tick as the breath mark symbol

Vocal and wind music frequently uses a tick mark as a breathing sign. This indicates a breath that subtracts a little time from the previous note rather than causing a short pause, which is indicated by the comma breath mark. The mark can be moved up a little to take it away from the stave.

Using a tick as the breath mark symbol

Using ad hoc paper sizes

This snippet shows how to define custom paper sizes.

Using ad hoc paper sizes

Using alternative flag styles

Alternative styles of flag on eighth and shorter notes can be displayed by overriding the stencil property of Flag. Valid values are modern-straight-flag, old-straight-flag and flat-flag.

Using alternative flag styles

Using an extra voice for breaks

Often it is easier to manage line and page-breaking information by keeping it separate from the music by introducing an extra voice containing only skips along with the \break, pageBreak and other layout information.

This pattern becomes especially helpful when overriding line-break-system-details and the other useful but long properties of NonMusicalPaperColumnGrob.

Using an extra voice for breaks

Using any arbitrary markup as LyricHyphen

Lyric hyphens have several user-modifiable properties such as length and thickness; this doesn’t allow, however, for further tweaking, for example, rendering hyphens as rounded boxes to better match the font possibly used for LyricText, or even printing hyphens as actual glyphs rather than drawing basic boxes.

This snippet rewrites the LyricHyphen stencil procedure to use a proper glyph… or indeed any arbitrary markup.

Using any arbitrary markup as LyricHyphen

Using arpeggioBracket to make divisi more visible

The arpeggioBracket can be used to indicate the division of voices where there are no stems to provide the information. This is often seen in choral music.

Using arpeggioBracket to make divisi more visible

Using arpeggioBracket to show special fingering

A common use of arpeggioBracket in piano music is to show that two keys are to be played with the same finger/thumb. This requires the use of transparent notes in another voice.

Using arpeggioBracket to show special fingering

Using autochange with more than one voice

Using autochange with more than one voice.

Using autochange with more than one voice

Using brackets instead of parentheses for \parenthesize

Sometimes a note is to be played only in special circumstances (e.g., only on the first repeat). One can use \parenthesize to put parentheses around the notehead. However, a different notation uses square brackets. This snippet shows how to tweak the settings for \parenthesize to use square brackets instead of parentheses. A function \bracketify is defined, which works similar to parenthesize.

Using brackets instead of parentheses for \parenthesize

Using double slurs for legato chords

Some composers write two slurs when they want legato chords. This can be achieved by setting doubleSlurs.

Using double slurs for legato chords

Using grace note slashes with normal heads

The slash through the stem found in acciaccaturas can be applied in other situations.

Using grace note slashes with normal heads

Using header fields in arbitrary markup

This snippet adds a markup function that allows one to use header fields (e.g. the title, composer, etc.) in arbitrary markup. By default, markups like bookTitleMarkup specified in the \paper block is treated differently than other markup, so that one can access header fields via \fromproperty #'header:fieldname in such markups. This does not work for toplevel markup or markup inside a score, so \fromproperty returns an empty string in this case.

The \markupWithHeader markup function defined in this snippet fixes this problem and makes the header fields available to markups, so that you can now use the same markups as for book/score titles also in other places throughout your score.

Using header fields in arbitrary markup

Using ly:grob-object to access grobs with \tweak

Some grobs can be accessed “laterally” from within another grob’s callback. These are usually listed as “layout objects” in the “Internal properties” section of a grob-interface. The function ly:grob-object is used to access these grobs.

Demonstrated below are some ways of accessing grobs from within a NoteHead callback, but the technique is not limited to NoteHeads. However, the NoteHead callback is particularly important, since it is the implicit callback used by the \tweak command.

The example function defined below ("display-grobs") is probably not that useful, but it demonstrates that the grobs are indeed being accessed.

Example console output:

#

()

#

Using ly:grob-object to access grobs with \tweak

Using lyrics as markup text

The snippet allows to re-use the lyrics as a markup, e.g., for extracting a libretto. It defines a \verse markup command to include \lyricmode text. You can decide to use a linebreak character or wrap lines in the marked places.
words = \lyricmode {
  Du lil -- le \markup \italic fis -- \markup \italic ker \nl 
  Du \markup \italic lil -- \markup \italic le fis -- ker
}
\markup {
  \override #'(line-width . 40) % set the line width
  \override #'(display-nl . #t) % show a newline character or break lines (default)
  \override #`(make-line . ,make-wordwrap-markup) % use word-wrapped and left aligned
                                                  % or justified (default) lines/paragraphs
  \verse #words
}

Using lyrics as markup text

Using lyrics to add sticking for a drum part

Here is a clean way of adding sticking information on a snare drum part using lyrics.

Using lyrics to add sticking for a drum part

Using make-connected-path-stencil to draw custom shapes

If you want to create a custom shape or symbol, you can use the make-connected-path-stencil scheme function. This function takes the following six arguments, and returns a stencil.

1. A list of lists defining the coordinates of the path. The path automatically starts at the origin point of (0 0). To draw a straight line to the next point, simply indicate the X and Y coordinates of the next point like this: (1 -3) To draw a cubic Bézier curve to the next point, enter a list of six numbers like this: (-6 -2 -6 7 0 5) The first two numbers are the X and Y coordinates of the first control point. The middle two are the X and Y coordinates of the second control point. The last two are the X and Y coordinates of the destination point.

2. A number indicating the thickness of the line.

3. A number that scales the stencil on the X-axis.

4. A number that scales the stencil on the Y-axis.

5. A boolean (#t / #f) indicating whether the path automatically connects back to the origin point (0 0).

6. A boolean (#t / #f) indicating whether the shape created by the path is to be filled.

This snippet demonstrates using stencils as an override for other stencils, and also how they can be used in \markup. The snippet also shows how to use ly:stencil-translate to shift the position of the stencil. This is sometimes needed since the origin point of the path is "hard-coded" to always be (0 0).

Using make-connected-path-stencil has several advantages compared with using ly:make-stencil and path (as shown here: http://lsr.di.unimi.it/LSR/Item?id=623). One is that you do not have to manually specify the width and height of the stencil, since it gets calculated automatically.

Using make-connected-path-stencil to draw custom shapes

Using marklines in a Frenched score

Using MarkLine contexts (such as in LSR1010) in a Frenched score can be problematic if all the staves between two MarkLines are removed in one system. The Keep_alive_together_engraver can be used within each StaffGroup to keep the MarkLine alive only as long as the other staves in the group stay alive.

Using marklines in a Frenched score

Using markup for a staff's instrumentName

The instrumentName property of a staff or a staff group can take arbitrary markup. For example, rather than writing Percussion, you can also print two sticks to indicate percussion.

This example also shows how to combine several text markup objects and properly shift them before overlaying them.

Using markup for a staff's instrumentName

Using non-standard clef positions and adding customized clef definitions

LilyPond supports a number of pre-defined clefs, all of which show the clef symbol on some staff line. If you need the clef symbol between two lines, say, you can either manually set Staff.clefGlyph, Staff.clefPosition, and Staff.middleCPosition to the appropriate values, or you can add your own clef definition so that you can use \clef myCustomClef, for example. This can be achieved by using the add-new-clef function which has the form:

(add-new-clef "myCustomClef" "clefs.GLYPH" clef-position octavation c0-position)

The parameters are as follows.

"myCustomClef" is the name of the new clef.

"clefs.GLYPH" describes the actual clef glyph (e.g., "clefs.g" for the treble clef, "clefs.neomensural.c" for the neomensural c glyph, etc.).

clef-position determines the position of the clef, counted from the center line of the staff. For example, a value of 1 means the clef is shown between the center line and the line above, 4 means the clef is shown on the top line, -2 means it is shown on the second line of the staff.

octavation describes the octave transposition, which is typically 0.

c0-position determines the position of middle C on the staff relative to clef-position. For example, a value of -2 means middle C will be two staff positions (lines or spaces) below clef-position.

Using non-standard clef positions and adding customized clef definitions

Using numbers as part of Lilypond variable names

It is said that you cannot use numbers as part of Lilypond variable names. They are taken as durations.

Here are possibilties to do so, anyway.

Defining them in scheme or as a string.

Using numbers as part of Lilypond variable names

Using path expressions to override stencils

The stencil expression path can be used to override stencils for any printed object. The advantage of using path instead of embedded-ps is that path is supported by both the PostScript and SVG backends, and uses the same syntax.

There are six commands available to use in a path expression, and all commands use prefix notation. The six commands are moveto, rmoveto, lineto, rlineto, curveto, and rcurveto. Note that the commands that begin with r are the relative variants of the other three commands.

The commands moveto, rmoveto, lineto, and rlineto take 2 arguments; they are the X and Y coordinates for the destination point.

The commands curveto and rcurveto create cubic Bézier curves, and take 6 arguments; the first two are the X and Y coordinates for the first control point, the second two are the X and Y coordinates for the second control point, and the last two are the X and Y coordinates for the destination point.

In addition this snippet shows how to create a filled stencil using path, and adds a scheme function to automatically resize custom stencils when individual staves are resized.

Using path expressions to override stencils

Using PostScript to generate special note head shapes

When a note head with a special shape cannot easily be generated with graphic markup, PostScript code can be used to generate the shape. This example shows how a parallelogram-shaped note head is generated.

Using PostScript to generate special note head shapes

Using Scheme to display the list of all supported midi instruments

Supported MIDI instruments are defined in the file scm/midi.scm. Using scheme, one can easily create a lilypond file displaying all supported midi names automatically.

The way to do this is to load the midi.scm file and then creating a \markup for each midi instrument definition. This is done by a markup-list function written in Scheme. The resulting list of markups can then be displayed using \markuplist.

Using Scheme to display the list of all supported midi instruments

Using tags to produce mensural and modern music from the same source

Using tags, it is possible to produce both mensural and modern notation from the same music. In this snippet, a function \menrest is introduced, allowing mensural rests to be pitched as in the original, but with modern rests in the standard staff position.

Tags can also be used where other differences are needed: for example using whole measure rests (R1, R\breve, etc.) in modern music, but normal rests (r1, r\breve, etc.) in the mensural version. Converting mensural music to its modern equivalent is usually referred to as transcription.

Using tags to produce mensural and modern music from the same source

Using the \tweak command to tweak individual grobs

With the \tweak command, every grob can be tuned directly. Here are some examples of available tweaks.

Using the \tweak command to tweak individual grobs

Using the high bass clef

The high bass clef looks exactly the same as the standard bass clef, but the music has to be played one octave up (compared with the treble clef). So it's equivalent to a "bass^8" clef where the octavation eight above the clef is removed.

It's used from the 18th century until approx. end of 20th century for french horn parts.

This usage of the F clef was inherited to the basset horn and the bass clarinet, too.

There also exists an alternate transposing instruction which instead of declaring the high bass clef tells you, you have to alter the instrument transposition every time you use the bass clef or when you switch back to using the treble clef - but this method makes transposing of a part much more complex than the usage of the high bass clef.

Using the high bass clef

Using the input-tag property to create musical outlines

Here's an example using Scheme code and the input-tag property to provide a way to mark up music in the manner similar to the "outlining" rehearsal technique recommended by James Boyk and Abigail Whiteside.

The basic idea of outlining is to practice passages at tempo from the very start by omitting most of the notes and gradually add more and more of the notes. It's a good rehearsal technique, but it takes some time to get used to. Hence the thought that a convenient way to visually and aurally demonstrate the technique might be useful.

This snippet defines a music function, \oLevel, that can be nested around sequences of notes to indicate an outline level. Once the music has been marked up with the \oLevel function, it can be rendered at any desired level of outlining by calling \outlineMusic in the score block with a numerical value to indicate the desired level of detail. It's somewhat similar to the way programmers often provide a "debug-level" command-line option. The higher the level, the more detail in the output.

As implemented here, the notes that are beyond the desired level of detail are replaced by repeats of prior notes and are shown with grey noteheads. See the attached image and example .ly file for more detail. Other implementations are certainly possible, e.g. replacing the notes with rests instead of showing them as repeated notes in grey.

From a programming standpoint, the input-tag property seems like a nice tool anytime you need to encode some information in the notation for later use when the output is rendered in a way that can't be handled by the \keepWithTag and \removeWithTag functions. There's one pitfall that took me a while to figure out -- ly:music-deep-copy does NOT copy the contents of input-tag even though it's a documented property. You need to provide some logic to handle that if you are generating multiple versions of the music and need to alter tags in the process of doing so.

CAVEAT: As implemented, this works well in a single voice. Trying to use it multiple voices will almost certainly give confusing results.

Using the input-tag property to create musical outlines

Using the whiteout property

Any graphical object can be printed over a white background to mask parts of objects that lie beneath. This can be useful to improve the appearance of collisions in complex situations when repositioning objects is impractical. It is necessary to explicitly set the layer property to control which objects are masked by the white background.

In this example the collision of the tie with the time signature is improved by masking out the part of the tie that crosses the time signature, setting the whiteout property of TimeSignature. To do this, TimeSignature is moved to a layer above Tie, which is left in the default layer 1, and StaffSymbol is moved to a layer above TimeSignature so it is not masked.

Using the whiteout property

Using ties with arpeggios

Ties are sometimes used to write out arpeggios. In this case, two tied notes need not be consecutive. This can be achieved by setting the tieWaitForNote property to #t. The same feature is also useful, for example, to tie a tremolo to a chord, but in principle, it can also be used for ordinary consecutive notes.

Using ties with arpeggios

UTF-8

Various scripts may be used for texts (like titles and lyrics) by entering them in UTF-8 encoding, and using a Pango based backend. Depending on the fonts installed, this fragment will render Bulgarian (Cyrillic), Hebrew, Japanese and Portuguese.

UTF-8

Variable bow thickness depending on length

If a house-style prefers to have thicker slurs (and/or ties, etc.), sometimes they can appear overly thick when their length is short. To counter this apparent increase of thickness, you can make the 'thickness property of slurs variable depending on its length.



The following snippet uses the function variable-bow-thickness which requires four values, two for min and max bow length (min-l and max-l, respectively) and two for min and max bow thickness (min-t and max-t, respectively). The final thickness is determined by the following conditions:


Variable bow thickness depending on length

Vaticana ligatures

Vaticana ligature uses four staff lines, special clef, and calligraphic notes.

Vaticana ligatures

Vertical brace spanning several lyrics lines

This example shows a trick to insert a vertical brace when going from several stanzas into a common ending in the lyrics. (An alternative is of course to just skip the brace, especially if you add a line break instead).

Vertical brace spanning several lyrics lines

Vertical line as a baroque articulation mark

This short vertical line placed above the note is commonly used in baroque music. Its meaning can vary, but generally indicates notes that should be played with more weight. The following example demonstrates how to achieve such a notation.

Vertical line as a baroque articulation mark

Vertical spacing of footnotes

Right now, LilyPond's abilities to format footnote text strings are quite limited: each footnote on a page is processed and emitted separately, with some whitespace (footnote-padding) inbetween. footnote-padding is also inserted between the footnote separator markup and the first footnote. A consequence of this very simplistic output model (i.e., using padding and not baseline-to-baseline distances) is uneven vertical spacing if some footnote text doesn't contain both ascenders (like letter ‘d’) and descenders (like letter ‘p’).

This snippet fixes the vertical spacing of footnotes. It defines a new command \Footnote that accepts either a markup (for single-line footnotes) or a markup list (for multi-line footnotes). The baseline-to-baseline distance of the lines in multi-line footnotes is controlled by the top-level baseline skip in the paper variable text-font-defaults.baseline-skip.

Vertical spacing of footnotes

Vertically aligned dynamics and textscripts

All DynamicLineSpanner objects (hairpins and dynamic texts) are placed with their reference line at least 'staff-padding from the staff, unless other notation forces them to be farther. Setting 'staff-padding to a sufficiently large value aligns the dynamics.

The same idea, together with \textLengthOn, is used to align the text scripts along their baseline.

Vertically aligned dynamics and textscripts

Vertically aligned StaffGroups without connecting SystemStartBar

This snippet shows how to achieve vertically aligned StaffGroups with a SystemStartBar for each StaffGroup, but without connecting them.

Vertically aligned StaffGroups without connecting SystemStartBar

Vertically aligning dynamics across multiple notes

Dynamics that occur at, begin on, or end on the same note will be vertically aligned. To ensure that dynamics are aligned when they do not occur on the same note, increase the staff-padding property of the DynamicLineSpanner object.

Vertically aligning dynamics across multiple notes

Vertically aligning ossias and lyrics

This snippet demonstrates the use of the context properties alignBelowContext and alignAboveContext to control the positioning of lyrics and ossias.

Vertically aligning ossias and lyrics

Vertically centered common lyrics

In a vocal piece where there are several (two, four or more) lines of lyrics and common lyrics for all voices at some point, the common lyrics may be made to appear vertically centered, as shown in the following example:

Vertically centered common lyrics

Vertically centering paired figured bass extenders

Where figured bass extender lines are being used by setting useBassFigureExtenders to true, pairs of congruent figured bass extender lines are vertically centered if figuredBassCenterContinuations is set to true.

Vertically centering paired figured bass extenders

Vocal ensemble template

Here is a standard four-part SATB vocal score. With larger ensembles, it is often useful to include a section which is included in all parts. For example, the time signature and key signature are almost always the same for all parts. Like in the Hymn template, the four voices are regrouped on only two staves.

Vocal ensemble template

Vocal ensemble template with automatic piano reduction

This template adds an automatic piano reduction to the standard SATB vocal score demonstrated in Vocal ensemble template. This demonstrates one of the strengths of LilyPond – you can use a music definition more than once. If any changes are made to the vocal notes (say, tenorMusic), then the changes will also apply to the piano reduction.

Vocal ensemble template with automatic piano reduction

Vocal ensemble template with lyrics aligned below and above the staves

This template is basically the same as the simple Vocal ensemble template, with the exception that here all the lyrics lines are placed using alignAboveContext and alignBelowContext.

Vocal ensemble template with lyrics aligned below and above the staves

Vocal ensemble template with verse and refrain

This template creates a score that starts with a solo verse and continues into a refrain for two voices. It also demonstrates the use of spacer rests within the \global variable to define meter changes (and other elements common to all parts) throughout the entire score.

Vocal ensemble template with verse and refrain

Vocal headword

Vocal headword

Vocal headword

Volta below chords

By adding the Volta_engraver to the relevant staff, volte can be put under chords.

Volta below chords

Volta multi staff

By adding the Volta_engraver to the relevant staff, volte can be put over staves other than the topmost one in a score.

Volta multi staff

Volta text markup using repeatCommands

Though volte are best specified using \repeat volta, the context property repeatCommands must be used in cases where the volta text needs more advanced formatting with \markup.

Since repeatCommands takes a list, the simplest method of including markup is to use an identifier for the text and embed it in the command list using the Scheme syntax #(list (list 'volta textIdentifier)). Start- and end-repeat commands can be added as separate list elements:

Volta text markup using repeatCommands

Watermark

Add a watermark directly into a LilyPond file, without using a third part PDF tool.

Watermark

White text on black background

If you want to print some white text on black background, here's the trick:

White text on black background

Wind headword

Wind headword

Wind headword

Woodwind diagrams key lists

The snippet below produces a list of all possible keys and key settings for woodwind diagrams as defined in scm/define-woodwind-diagrams.scm. The list will be displayed in the log file, but not in the music. If output to the console is wanted, omit the (current-error-port) from the commands.

Woodwind diagrams key lists

Woodwind diagrams listing

The following music shows all of the woodwind diagrams currently defined in LilyPond.

Woodwind diagrams listing

Write text on the right of a staff

\set Staff.instrumentName allows to write on the left side only.

Write text on the right of a staff

Writing intermediate rests or notes in glissandi

Here's a way to add a ghost rest or headless note to a glissando with an unusual duration.

Writing intermediate rests or notes in glissandi

⇦ Previous 1 2