The LilyPond Snippet Repository ♪♫

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

Automatically adjusting lyric placement for natural note spacing

This snippet gets rid of uglinesses in note spacing caused by lyrics. By default, LilyPond always puts a lyric word exactly centered under the note it attaches to. When there is a long lyric word, LilyPond reserves space between notes so that there will be no collisions in the lyrics. However, this can lead to uneven note spacing. This snippet completely removes the presence of lyrics in note spacing so that it is natural according to the note lengths, and uses a spacing algorithm that shifts lyrics automatically in order to avoid collisions.

Automatically adjusting lyric placement for natural note spacing

Automatically change durations

shiftDurations can be used to change the note lengths of a piece of music.

It takes two arguments – the scaling factor as a power of two, and the number of dots to be added as a positive integer.

Automatically change durations

Automatically changing the stem direction of the middle note based on the melody

LilyPond can alter the stem direction of the middle note on a staff so that it follows the melody, by adding the Melody_engraver to the Voice context.

The context property suspendMelodyDecisions may be used to turn off this behavior locally.

Automatically changing the stem direction of the middle note based on the melody

Automatically coloring grobs to indicate when their direction has been manually set

When editing a piece of music, it can be helpful to see when the directions of slurs, stems, or other grobs have been manually set (as opposed to being automatically set by LilyPond). This snippet changes the color of grobs when their direction has been manually set. Red indicates up, and blue indicates down. It can be applied to all grobs, or just to certain types of grob (i.e. just Slur, or just Slur and TextScript).

Automatically coloring grobs to indicate when their direction has been manually set

Automatically convert beams [ ] into slurs ( ) to indicate melisma

Traditionally, vocal scores used beams to indicate melisma, while modern vocal scores tend to use slurs. With this snippet's \beamsToSlurs music function you can easily produce either type of output from the same music input, allowing you to have both traditional and modern vocal engraving with one unique source. The function automatically converts manually typeset beams: [ ] ...into slurs: ( ).

Automatically convert beams [ ] into slurs ( ) to indicate melisma

Automatically creating a drone part from a given melody

If you want to automatically create a "drone part" to go with a melody (for example, for a MIDI file of bagpipe music) you can use the \dronify music function in this snippet.This function takes two arguments, a drone pitch and a melody, and returns the melody as follows:(1) the pitch of each note is changed to the drone pitch,(2) ties are added between all the notes for a continuous drone sound,(3) rests in the melody are mirrored by rests in the drone part.

Automatically creating a drone part from a given melody

Automatically display key names above key signatures

This snippet automatically displays the name of the key above the key signature. This is helpful when learning the key signatures, or to easily see whether a key is major, minor, or modal (dorian, phrygian, lydian, etc.). It works by creating a custom key signature engraver.

Automatically display key names above key signatures

Avoiding collision in single staff polyphony

When you typeset some polyphonic music on a single staff, especially when you have different dotted note heads, you sometimes meet collision between note heads, and don't want them to merge automatically. Using \override NoteColumn #'force-hshift = #X.Y allows you to separate these colliding note heads, inserting the appropriate amount of blank space (X.Y) between them.

Avoiding collision in single staff polyphony

Avoiding collisions with chord fingerings

Fingerings and string numbers applied to individual notes will automatically avoid beams and stems, but this is not true by default for fingerings and string numbers applied to the individual notes of chords. The following example shows how this default behavior can be overridden.

Avoiding collisions with chord fingerings

Bach's Accent steigend and Accent fallend

In the "15 Inventions and 15 Symphonies" (aka "Two- and Three-Part Inventions"), Bach uses an articulation sign, called "Accent steigend" or "Accent fallend," to indicate a grace-like note ascending or descending to the articulated note. The sign is placed about where the head of a grace note would go. It looks like a large backwards comma, or small left parenthesis. This articulation occurs in Inventio 3, shown in the third bar of the example. I defined a variable, \BachAccentFallendFromGrace that modifies an appropriately placed grace note to look like the Accent fallend. The Accent steigend should have the vertical placement adjusted slightly differently.

Bach's Accent steigend and Accent fallend

⇦ Previous 11 12 13 14 15 16 17 18 19 20 Next ⇨