The LilyPond Snippet Repository ♪♫

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

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

Creating a short ossia section with lyrics

In vocal scores for a chorus the music for the soloists is sometimes omitted. In such cases a vocal cue can be inserted as a short ossia section.

Creating a short ossia section with lyrics

Creating arbitrary lines following notes across staves

In the snippet, you'll see that "s2" was used instead of "r2" as a placeholder to space it out a little bit. VoiceFollower ignores this -- when r2 was used it would try to draw a line from the rest to the note head, while philosophically interesting would be wrong.

Creating arbitrary lines following notes across staves

Creating arpeggios across notes in different voices

An arpeggio can be drawn across notes in different voices on the same staff if the Span_arpeggio_engraver is added to the Staff context:

Creating arpeggios across notes in different voices

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