The LilyPond Snippet Repository ♪♫

What's this? Searching the LSR Browse by date Contributing Snippet database Browsing items 260−269 out of 949

Controlling the vertical ordering of scripts

The vertical ordering of scripts is controlled with the 'script-priority property. The lower this number, the closer it will be put to the note. In this example, the TextScript (the sharp symbol) first has the lowest priority, so it is put lowest in the first example. In the second, the prall trill (the Script) has the lowest, so it is on the inside. When two objects have the same priority, the order in which they are entered determines which one comes first.

Controlling the vertical ordering of scripts

Controlling the vertical ordering of scripts (2)

The vertical ordering of scripts can be either tweaked with the 'script-priority or the 'outside-staff-priority property. The lower this number the closer it will be put to the note.

Controlling the vertical ordering of scripts (2)

Controlling tuplet bracket visibility

The default behavior of tuplet-bracket visibility is to print a bracket unless there is a beam of the same length as the tuplet.

To control the visibility of tuplet brackets, set the property bracket-visibility to either #t (always print a bracket), if-no-beam (only print a bracket if there is no beam) or #f (never print a bracket). The latter is in fact equivalent to omitting the TupletBracket object altogether from the printed output.

Controlling tuplet bracket visibility

Cow and ride bell example

Two different bells, entered with 'cb' (cowbell) and 'rb' (ridebell).

Cow and ride bell example

Creating "real" parenthesized dynamics

Although the easiest way to add parentheses to a dynamic mark is to use a \markup block, this method has a downside: the created objects will behave like text markups, and not like dynamics.

However, it is possible to create a similar object using the equivalent Scheme code (as described in the Notation Reference), combined with the make-dynamic-script function. This way, the markup will be regarded as a dynamic, and therefore will remain compatible with commands such as \dynamicUp or \dynamicDown.

Creating "real" parenthesized dynamics

Creating a “tacet al fine” rest

When an instrument has no music for the remainder of a piece or movement, it is common to put a single multi-measure rest with a “tacet al fine” marking, which suppresses/replaces all music changes (time signatures, key signatures, rehearsal marks, etc.). This snippet demonstrates how to truncate a musical expression at a given measure and simply append a “tacet al fine” measure.

Creating a “tacet al fine” rest

Creating a custom clef glyph

This snippet shows how to print a new clef glyph - here an old style bass clef - with a path encoding (support svg output).

Creating a custom clef glyph

Creating a delayed turn

Creating a delayed turn, where the lower note of the turn uses the accidental, requires several overrides. The outside-staff-priority property must be set to #f, as otherwise this would take precedence over the avoid-slur property. Changing the fractions 2/3 and 1/3 adjusts the horizontal position.

Creating a delayed turn

Creating a Schenker Graph

The music theorist Heinrich Schenker created a method of analysing tonal music using, what are now known as Schenker graphs or diagrams. These use normal musical notation in non-standard ways.

Major problems creating a Schenker graph with lilypond are:

  1. Precise alignment of notes between staves needed,
  2. Note heads, stems, beams etc are used to notate musical structure not rhythm,
  3. A note head may have more than one stem or none,
  4. Slurs may be nested arbitrarily and can connect to both left and right of the same note head,
  5. Harmonic connection lines may be drawn between staves.

Solutions:

  1. By default all notes are eight notes and the (invisible) time signature is 1/8. A missing note head is implemented as a transparent note rather than a skip.
  2. Most grobs are, by default, invisible. Each staff is structured as a series of layers, implemented as voices, containing all the notes, NoteCollision #'merge-differently-headed is set to true. Note heads are only visible in the notes voice, note heads are determined by setting NoteHead #'duration-log.
  3. Harmonic connections are implemented by a note followers in separate layers.

Creating a Schenker Graph

Creating a sequence of notes on various pitches

In music that contains many occurrences of the same sequence of notes at different pitches, the following music function may prove useful. It takes a note, of which only the pitch is used.

This example creates the rhythm used throughout Mars, from Gustav Holst's The Planets.

Creating a sequence of notes on various pitches

⇦ Previous 21 22 23 24 25 26 27 28 29 30 Next ⇨