The LilyPond Snippet Repository ♪♫

What's this? Searching the LSR Browse by date Contributing Snippet database Browsing items 30−39 out of 875

Adding fingerings to chords

Fingerings for chords can be obtained by adding them to individual pitches.

Adding fingerings to chords

Adding fingerings to tablatures

To add fingerings to tablatures, use a combination of \markup and \finger.

Adding fingerings to tablatures

Adding indicators to staves which get split after a break

This snippet defines the \splitStaffBarLine, convUpStaffBarLine and convDownStaffBarLine commands. These add arrows at a bar line, to denote that several voices sharing a staff will each continue on a staff of their own in the next system, or that voices split in this way recombine.

Adding indicators to staves which get split after a break

Adding instrument name and clef change to cue notes

Lilypond provides the \cueDuring and \transposedCueDuring commands to add cue notes. However, these commands do neither print any cue instrument name, nor do they allow the cue notes to be in a different clef than the quoting voice.

To be able to add cue instrument names and/or clef changes, as a workaround, you can define your own function that sets instrumentCueName and the clef for the staff. At the end of the cue music (typically R1*2), you'll have to reset them again. This snippet combines these steps into one function:

The example also shows how to modify properties of the displayed cue instrument names: They are generated as InstrumentSwitch objects, which support all different kinds of interfaces, like the font-interface to modify font settings.

The disadvantage of this solution is that you always have to manually give the instrument name and clef of the quoting voice, because otherwise the function is not able to reset these. However, there is currently no way known to me how to set the instrument name and clef for a quoted voice automatically.

Adding instrument name and clef change to cue notes

Adding line between fingerings or a glissando between nonadjacent notes

Need a glissando between two nonadjacent notes or a line between two fingerings?

\guide = dashed line.

\gliss = glissando line.

Adding line between fingerings or a glissando between nonadjacent notes

Adding line breaks in MIDI Karaoke lyrics without disrupting printed score

Lyrics can be added with the \addlyrics command, and they will appear in both the layout and midi. The MIDI Karaoke standard allows for the concept of line breaks, usually introduced with either a slash or a backslash at the beginning of a lyric syllable, but placing either of those characters in the lyrics is both messy in the .ly file and disruptive to the printable version (either character will display in the end result).

The perfect solution is to start the lyric syllable with \n - at least, it seems to work with vanBasco's Karaoke Player for Windows (confirmation with other players requested!) However, this is immensely ugly in the LilyPond source:

\addlyrics {
  "\nDoe," a deer, a fe- male deer,
  "\nRay," a drop of gol- den sun,
  "\nMe," a name I call my- self,
  "\nFar," a long long way to run!
}
It's especially ugly if the first word of the line has more than one syllable (the quote in the middle of the word).

With a bit of Scheming, this can be made far cleaner. The function recursively searches its argument for LyricEvents and replaces any leading exclamation mark with a newline.

\addlyrics {
  \lyr {
    !Doe, a deer, a fe- male deer,
    !Ray, a drop of gol- den sun,
    !Me, a name I call my- self,
    !Far, a long long way to run!
  }
}

Adding line breaks in MIDI Karaoke lyrics without disrupting printed score

Adding links to objects

To add a link to a grob-stencil you could use add-link as defined here. Works with \override and \tweak.

Drawback: point-and-click will be disturbed for the linked grobs.

Limitation: Works for PDF only.

The linked objects are colored with a separate command.

Adding links to objects

Adding markups in a tablature

By default markups does not show in a tablature.

To make them appear, simply use the command \revert TabStaff.TextScript.stencil

Adding markups in a tablature

Adding metronome ticks to a piece of music

If you need to produce a piece of music with metronome ticks, optionally only in the midi, you can use this boilerplate code. Note that it sounds nicer than it looks :) .

Adding metronome ticks to a piece of music

Adding notes

A note is printed by specifying its pitch and then its duration.

Adding notes

⇦ Previous 1 2 3 4 5 6 7 8 9 10 Next ⇨